From acb216d31c321da7b4e45e5ad2ff04300c98234d Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 18 Sep 2015 12:06:51 +0200 Subject: UHD: do not print length 1 messages --- src/OutputUHD.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp index 48ad4c7..a82550f 100644 --- a/src/OutputUHD.cpp +++ b/src/OutputUHD.cpp @@ -50,6 +50,12 @@ using namespace std; typedef std::complex complexf; +std::string stringtrim(const std::string &s) +{ + auto wsfront = std::find_if_not(s.begin(), s.end(), [](int c){return std::isspace(c);} ); + return std::string(wsfront, std::find_if_not(s.rbegin(), std::string::const_reverse_iterator(wsfront), [](int c){return std::isspace(c);} ).base()); +} + void uhd_msg_handler(uhd::msg::type_t type, const std::string &msg) { if (type == uhd::msg::warning) { @@ -59,7 +65,10 @@ void uhd_msg_handler(uhd::msg::type_t type, const std::string &msg) etiLog.level(error) << "UHD Error: " << msg; } else { - etiLog.level(debug) << "UHD Message: " << msg; + // do not print very short U messages and such + if (stringtrim(msg).size() != 1) { + etiLog.level(debug) << "UHD Message: " << msg; + } } } -- cgit v1.2.3