Hi guys,
I want to initialize simple log. I do the next:
#include
#include
#include
void init()
{
boost::log::add_file_log
(
boost::log::keywords::file_name = "sample_%Y%m%d.log",
boost::log::keywords::auto_flush = true,
boost::log::keywords::open_mode = (std::ios::out | std::ios::app),
boost::log::keywords::format = "[%TimeStamp%] [%Severity%]:
%Message%"
);
boost::log::add_common_attributes();
}
int main(int, char*[])
{
init();
BOOST_LOG_TRIVIAL( trace ) << "A trace severity message";
BOOST_LOG_TRIVIAL( debug ) << "A debug severity message";
BOOST_LOG_TRIVIAL( info ) << "An informational severity message";
BOOST_LOG_TRIVIAL( warning ) << "A warning severity message";
BOOST_LOG_TRIVIAL( error ) << "An error severity message";
BOOST_LOG_TRIVIAL( fatal ) << "A fatal severity message";
return 0;
}
But in log I receive:
[2015-Jan-11 09:51:04.082221] []: A trace severity message
[2015-Jan-11 09:51:04.082221] []: A debug severity message
[2015-Jan-11 09:51:04.082221] []: An informational severity message
[2015-Jan-11 09:51:04.092221] []: A warning severity message
[2015-Jan-11 09:51:04.092221] []: An error severity message
[2015-Jan-11 09:51:04.092221] []: A fatal severity message
And my question is how to initialize logging to write severity level in
messages?
What do I miss?
Thank you.
--
Best Regards,
Igor Mironchik.