aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-04-19 11:50:27 -0700
committerMartin Braun <martin.braun@ettus.com>2018-04-26 17:44:49 -0700
commita061c617de11b433b1fae733738a2984c83f00dc (patch)
treeafc860111c3bfe7e2db5c4f5ba348ad908620036 /host
parentfb1b7b78687da3653c0461394cee7135e701bfd5 (diff)
downloaduhd-a061c617de11b433b1fae733738a2984c83f00dc.tar.gz
uhd-a061c617de11b433b1fae733738a2984c83f00dc.tar.bz2
uhd-a061c617de11b433b1fae733738a2984c83f00dc.zip
log: Add method for local generation of messages in log.cpp
Diffstat (limited to 'host')
-rw-r--r--host/lib/utils/log.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/host/lib/utils/log.cpp b/host/lib/utils/log.cpp
index 58341b9b6..a29c275a8 100644
--- a/host/lib/utils/log.cpp
+++ b/host/lib/utils/log.cpp
@@ -204,16 +204,7 @@ public:
<< "Boost_"
<< BOOST_VERSION << "; "
<< "UHD_" << uhd::get_version_string();
- auto sys_info_log_msg = uhd::log::logging_info(
- pt::microsec_clock::local_time(),
- uhd::log::info,
- __FILE__,
- __LINE__,
- "UHD",
- boost::this_thread::get_id()
- );
- sys_info_log_msg.message = sys_info.str();
- _log_queue.push_with_timed_wait(sys_info_log_msg, 0.25);
+ _publish_log_msg(sys_info.str(), uhd::log::info, "UHD");
}
// Launch log message consumer
@@ -421,6 +412,23 @@ private:
}
}
+ void _publish_log_msg(
+ const std::string& msg,
+ const uhd::log::severity_level level=uhd::log::info,
+ const std::string& component="LOGGING"
+ ) {
+ auto log_msg = uhd::log::logging_info(
+ pt::microsec_clock::local_time(),
+ level,
+ __FILE__,
+ __LINE__,
+ component,
+ boost::this_thread::get_id()
+ );
+ log_msg.message = msg;
+ _log_queue.push_with_timed_wait(log_msg, 0.25);
+ }
+
std::mutex _logmap_mutex;
std::atomic<bool> _exit;
using level_logfn_pair =