I have a BOOST_LOG_GLOBAL_LOGGER(myLogger, severity_channel_logger_mt)
I created/added a console logger to this global logger within the BOOST_LOG_GLOBAL_LOGGER_INIT
. how do I add a file_log that only logs records from specific channels. I have two file sinks setup, but log records end up in both files.
//in some function
shared_ptr<text_file_backend> backend = make_shared<text_file_backend>(
keywords::filename = // provided path,
keywords::filter = channel == "default");
shared_ptr<synchronous_sink<text_file_backend>> sink= shared_ptr<synchronous_sink<text_file_backend>>(new synchronous_sink<text_file_backend>(backend));
logging::core::get()->add_sink(sink);
//------------------
//in some other function
shared_ptr<text_file_backend> backend = make_shared<text_file_backend>(
keywords::filename = // provided path,
keywords::filter = channel == // provided channel);
shared_ptr<synchronous_sink<text_file_backend>> sink= shared_ptr<synchronous_sink<text_file_backend>>(new synchronous_sink<text_file_backend>(backend));
logging::core::get()->add_sink(sink);
I have tried adding another file sink with a filter to check a specific channel but it does not work .