c++ - Filtering non-trivial loggers in Boost.Log? -


i'm trying figure out how enable simple filter in combination boost_log_sev.

for example, if set up:

enum class severitylevel {   foo,   bar };  boost::log::sources::severity_logger_mt<severitylevel> slg;  boost_log_sev(slg, severitylevel::foo) << "foo log record"; boost_log_sev(slg, severitylevel::bar) << "bar log record"; 

i'd able add this:

slg.set_minimum_severity(severitylevel::bar);  // filter out foo logs 

the boost.log docs jump rather filtering on trivial logs more complicated cases.

first, little secret may want know reading boost log documentation, code examples more complete summaries on doc pages. if understand right should happy example

http://www.boost.org/doc/libs/1_54_0/libs/log/example/doc/tutorial_filtering.cpp

look set_filter line, , adapt to:

sink->set_filter(severity >= severitylevel::bar); 

for more advanced filters asked related question on boost users mailing list:

http://lists.boost.org/boost-users/2013/10/80211.php


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -