I would like to be able to specify the logging severity level from config:
# my config file
LogSeverity = info
How can I do this? Currently I've got something like this in my main
function:
// logging settings
boost::log::trivial::severity_level logSeverity;
boost::program_options::options_description loggingSettings
("Logging settings");
loggingSettings.add_options()
("LogSeverity", value<boost::log::trivial::severity_level>(&logSeverity)
->required(),
"log level to output");
variables_map vm;
store(parse_config_file(configFilestream, loggingSettings), vm);
notify(vm);
boost::log::core::get()->set_filter(
boost::log::trivial::severity >= logSeverity);
BOOST_LOG_TRIVIAL(info) << "severity " << logSeverity;
The output of this program is:
[2015-05-18 09:58:40.783298] [0x000007f017445078] [info] severity trace
However, I set the severity to info
in my config (as above), so why is it being set to trace
?