diff options
Diffstat (limited to 'host/lib/utils')
-rw-r--r-- | host/lib/utils/log.cpp | 2 | ||||
-rw-r--r-- | host/lib/utils/msg.cpp | 18 |
2 files changed, 14 insertions, 6 deletions
diff --git a/host/lib/utils/log.cpp b/host/lib/utils/log.cpp index f67a14411..8b270af6b 100644 --- a/host/lib/utils/log.cpp +++ b/host/lib/utils/log.cpp @@ -209,6 +209,6 @@ uhd::_log::log::~log(void){ uhd_logger_stream_resource().aquire(false); } -std::ostream & uhd::_log::log::get(void){ +std::ostream & uhd::_log::log::operator()(void){ return uhd_logger_stream_resource().get(); } diff --git a/host/lib/utils/msg.cpp b/host/lib/utils/msg.cpp index 0eaca05a5..e850b5a6d 100644 --- a/host/lib/utils/msg.cpp +++ b/host/lib/utils/msg.cpp @@ -34,11 +34,19 @@ static void msg_to_cout(const std::string &msg){ std::stringstream ss; - BOOST_FOREACH(const std::string &line, tokenizer(msg, "\n")){ - ss << "-- " << line << std::endl; + static bool just_had_a_newline = true; + BOOST_FOREACH(char ch, msg){ + if (just_had_a_newline){ + just_had_a_newline = false; + ss << "-- "; + } + if (ch == '\n'){ + just_had_a_newline = true; + } + ss << ch; } - std::cout << ss.str(); + std::cout << ss.str() << std::flush; } static void msg_to_cerr(const std::string &title, const std::string &msg){ @@ -49,7 +57,7 @@ static void msg_to_cerr(const std::string &title, const std::string &msg){ ss << " " << line << std::endl; } - std::cerr << ss.str(); + std::cerr << ss.str() << std::flush; } /*********************************************************************** @@ -110,6 +118,6 @@ uhd::msg::_msg::~_msg(void){ msg_mutex.unlock(); } -std::ostream & uhd::msg::_msg::get(void){ +std::ostream & uhd::msg::_msg::operator()(void){ return msg_ss; } |