I am trying to create a Global Logger within my entire application so I can use
src::severity_logger_mt< >& lg = my_logger::get();
to get the global logger for different classes (resided in different files) logging.
I try to follow the example listed in boost.org (as listed below). But does not seems to work. Did anyone know any example I can follow or what I need to do make if works. Thanks.
http://www.boost.org/doc/libs/1_54_0/libs/log/doc/html/log/detailed/sources.html
BOOST_LOG_GLOBAL_LOGGER(my_logger, src::severity_logger_mt)
// my_logger.h
// ===========
#include "my_logger.h"
BOOST_LOG_GLOBAL_LOGGER_INIT(my_logger, src::severity_logger_mt)
{
src::severity_logger_mt< > lg;
lg.add_attribute("StopWatch", boost::make_shared< attrs::timer >());
return lg;
}
// my_logger.cpp
// ===========
#include "my_logger.h"
BOOST_LOG_GLOBAL_LOGGER_INIT(my_logger, src::severity_logger_mt)
{
src::severity_logger_mt< > lg;
lg.add_attribute("StopWatch", boost::make_shared< attrs::timer >());
return lg;
}