From 3a995b35532307930e2a999c551ffa2ab17ffbe6 Mon Sep 17 00:00:00 2001
From: Martin Braun <martin.braun@ettus.com>
Date: Thu, 18 Jan 2018 12:31:34 -0800
Subject: logging: Fix version print at top of every UHD session

---
 host/lib/utils/log.cpp | 38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)

(limited to 'host/lib/utils')

diff --git a/host/lib/utils/log.cpp b/host/lib/utils/log.cpp
index 2e10bc6a3..0dd06e99c 100644
--- a/host/lib/utils/log.cpp
+++ b/host/lib/utils/log.cpp
@@ -222,23 +222,27 @@ public:
             auto F = boost::make_shared<file_logger_backend>(log_file_target);
             _loggers[UHD_FILE_LOGGER_KEY] = [F](const uhd::log::logging_info& log_info){F->log(log_info);};
         }
-        std::ostringstream sys_info;
-        sys_info \
-          << "UHD" \
-          << BOOST_PLATFORM << "; "
-          << BOOST_COMPILER << "; "
-          << "Boost_"
-          << BOOST_VERSION << "; "
-          << "UHD_" << uhd::get_version_string();
-        _log_queue.push_with_timed_wait(
-            uhd::log::logging_info(
-               pt::microsec_clock::local_time(),
-               uhd::log::info,
-               __FILE__,
-               __LINE__,
-               sys_info.str(),
-                boost::this_thread::get_id()),
-            0.25);
+
+        // On boot, we print the current UHD version info:
+        {
+            std::ostringstream sys_info;
+            sys_info \
+              << BOOST_PLATFORM << "; "
+              << BOOST_COMPILER << "; "
+              << "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);
+        }
 
         // Launch log message consumer
         _pop_task = std::make_shared<std::thread>(std::thread([this](){this->pop_task();}));
-- 
cgit v1.2.3