diff options
Diffstat (limited to 'src/components/utils/include/utils/logger/boostlogger.h')
-rw-r--r-- | src/components/utils/include/utils/logger/boostlogger.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/components/utils/include/utils/logger/boostlogger.h b/src/components/utils/include/utils/logger/boostlogger.h index b7eeb7ab61..06bb13049a 100644 --- a/src/components/utils/include/utils/logger/boostlogger.h +++ b/src/components/utils/include/utils/logger/boostlogger.h @@ -32,11 +32,19 @@ #pragma once #define BOOST_LOG_DYN_LINK 1 + #include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/log/sources/severity_channel_logger.hpp> +#include <boost/log/sources/severity_logger.hpp> +#include <boost/log/trivial.hpp> #include "utils/ilogger.h" namespace logger { +namespace logging = boost::log; +namespace src = boost::log::sources; +namespace attrs = boost::log::attributes; + class BoostLogger : public ThirdPartyLoggerInterface { public: BoostLogger(const std::string& filename); @@ -47,6 +55,15 @@ class BoostLogger : public ThirdPartyLoggerInterface { void PushLog(const LogMessage& log_message) override; private: + struct LogAttributes { + attrs::mutable_constant<boost::posix_time::ptime> timestamp_; + attrs::mutable_constant<std::thread::id> thread_id_; + attrs::mutable_constant<std::string> component_; + attrs::mutable_constant<std::string> file_name_; + attrs::mutable_constant<int> line_num_; + attrs::mutable_constant<std::string> trace_; + }; + boost::posix_time::ptime GetLocalPosixTime( const logger::TimePoint& timestamp); @@ -54,6 +71,8 @@ class BoostLogger : public ThirdPartyLoggerInterface { const std::string& full_function_signature); std::string filename_; + src::severity_logger<logging::trivial::severity_level> slg_; + LogAttributes lg_attr_; }; } // namespace logger |