
Florian Lindner wrote:
Hello,
I have this piece of code: http://pastebin.com/iMyyaB6a
It adds a file and a console log and reads in a file config:
[Core] # Filter="%Severity% > 1"
[Sinks.MyConsoleSink1] Destination=Console
and prints some messages:
using namespace boost::log::trivial; boost::log::sources::severity_logger
lg; BOOST_LOG_SEV(lg, trace) << "A trace severity message"; BOOST_LOG_SEV(lg, debug) << "A debug severity message"; BOOST_LOG_SEV(lg, info) << "An informational severity message"; BOOST_LOG_SEV(lg, warning) << "A warning severity message"; BOOST_LOG_SEV(lg, error) << "An error severity message"; BOOST_LOG_SEV(lg, fatal) << "A fatal severity message"; It does exactly what I want, prints each message twice to the console. But when I uncomment the Filter expression it prints nothing.
Why not? Severity > 1 means everything info and above, doesn't it?
Ok, it seems in order to use Severity you got to register it before adding
the sinks:
boost::log::register_simple_formatter_factory