[log] Retrieving the current trivial severity level
Is there any method of retrieve the current severity level from a "boost::log::sources::severity_logger_mtboost::log::trivial::severity_level" logger. I would like to store the current severity level in a temporary variable, upgrade it to a new level using "BOOST_LOG_SEV(logger::get(), boost::log::trivial::trace)" to write a trace-type message, and then downgrade the logger back to the previous setting by recalling "BOOST_LOG_SEV(logger::get(), temporaryVariable)" -- View this message in context: http://boost.2283326.n4.nabble.com/log-Retrieving-the-current-trivial-severi... Sent from the Boost - Users mailing list archive at Nabble.com.
-----Original Message----- From: Chris Stylianou [mailto:chris5287@gmail.com] Sent: 20 August 2013 12:55 To: boost-users@lists.boost.org Subject: [Boost-users] [log] Retrieving the current trivial severity level Is there any method of retrieve the current severity level from a "boost::log::sources::severity_logger_mtboost::log::trivial::severity_level" logger. I would like to store the current severity level in a temporary variable, upgrade it to a new level using "BOOST_LOG_SEV(logger::get(), boost::log::trivial::trace)" to write a trace-type message, and then downgrade the logger back to the previous setting by recalling "BOOST_LOG_SEV(logger::get(), temporaryVariable)" -- View this message in context: http://boost.2283326.n4.nabble.com/log-Retrieving-the-current-trivial-severi... Sent from the Boost - Users mailing list archive at Nabble.com. I do not think loggers are "set to" any particular log level at any one time. I believe every time you log you must supply a log level, unless I have missed something. Or do you mean filtering? Perhaps you could have a global variable g_LogLevel. e.g.: boost::log::trivial::severity_level g_LogLevel = boost::log::trivial::info; ... BOOST_LOG_SEV(logger::get(), g_LogLevel); //Log at the current level BOOST_LOG_SEV(logger::get(), boost::log::trivial::trace); //Log at a specific level When you want to change log levels totally, just change g_LogLevel. Store the value in a temporary variable first if you want to reset it later. Regards Colin
participants (2)
-
Chris Stylianou
-
Colin Powers