标签:
boost::log::sources::logger lg;
BOOST_LOG_INLINE_GLOBAL_LOGGER_DEFAULT(my_logger, boost::log::sources::logger_mt);
boost::log::sources::logger_mt& lg = my_logger::get();
#include <boost/log/sources/logger.hpp>
#include <boost/log/sources/record_ostream.hpp>
#include <boost/log//sources/global_logger_storage.hpp>
BOOST_LOG_INLINE_GLOBAL_LOGGER_DEFAULT(my_logger, boost::log::sources::logger_mt);
int main()
{
boost::log::sources::logger_mt& lg = my_logger::get();
boost::log::record rec = lg.open_record();
if (rec)
{
boost::log::record_ostream strm(rec);
strm << "Hello, World!";
strm.flush();
lg.push_record(boost::move(rec));
}
return 0;
}
#include <boost/log/sources/logger.hpp>
#include <boost/log/sources/record_ostream.hpp>
#include <boost/log//sources/global_logger_storage.hpp>
BOOST_LOG_INLINE_GLOBAL_LOGGER_DEFAULT(my_logger, boost::log::sources::logger_mt);
int main()
{
boost::log::sources::logger_mt& lg = my_logger::get();
boost::log::record rec = lg.open_record();
if (rec)
{
BOOST_LOG(lg) << "Hello, World!";
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/zhangpanyi/p/4462538.html