From: Helge Norberg Date: Tue, 22 Nov 2016 21:14:42 +0000 (+0100) Subject: [logging] Made the Linux ThreadId be the actual thread id in the log. X-Git-Tag: 2.1.0_Beta2~146 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=0db6bafd8d8b2041feac7d0c98c6e46049a48eb6;p=casparcg [logging] Made the Linux ThreadId be the actual thread id in the log. --- diff --git a/common/log.cpp b/common/log.cpp index 1ad6a38f7..b6488739d 100644 --- a/common/log.cpp +++ b/common/log.cpp @@ -23,6 +23,7 @@ #include "log.h" +#include "os/threading.h" #include "except.h" #include "utf.h" @@ -47,7 +48,7 @@ #include #include #include -#include +#include #include #include @@ -121,7 +122,7 @@ void my_formatter(bool print_all_characters, const boost::log::record_view& rec, std::wstringstream pre_message_stream; append_timestamp(pre_message_stream); - thread_id_column.write(pre_message_stream, boost::log::extract("ThreadID", rec).get().native_id()); + thread_id_column.write(pre_message_stream, boost::log::extract("NativeThreadId", rec)); severity_column.write(pre_message_stream, boost::log::extract("Severity", rec)); auto pre_message = pre_message_stream.str(); @@ -145,6 +146,7 @@ namespace internal{ void init() { boost::log::add_common_attributes(); + boost::log::core::get()->add_global_attribute("NativeThreadId", boost::log::attributes::make_function(&get_current_thread_id)); typedef boost::log::sinks::asynchronous_sink stream_sink_type; auto stream_backend = boost::make_shared();