#include <boost/log/common.hpp>
#include <boost/log/core.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/filters.hpp>
#include <boost/log/formatters.hpp>
#include <boost/log/utility/init/to_file.hpp>
enum severity_level
{
normal,
notification,
warning,
error,
critical
};
BOOST_LOG_DECLARE_GLOBAL_LOGGER_INIT(my_logger, boost::log::sources::severity_logger< >)
{
boost::log::init_log_to_file
(
boost::log::keywords::file_name = "/home/olivier/ville_numerique.log",
boost::log::formatters::attr< unsigned int >("LineID"),
boost::log::keywords::format = "[%TimeStamp%]: %_%" // log record format
);
// boost::log::core::get()->set_filter
// (
// boost::log::filters::attr< boost::log::trivial::severity_level >("Severity") >= boost::log::trivial::info
// );
return boost::log::sources::severity_logger< >();
} |