/* * Copyright Andrey Semashev 2007 - 2015. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) */ #include #include #include #include #include namespace logging = boost::log; namespace src = boost::log::sources; namespace keywords = boost::log::keywords; //[ example_tutorial_formatters_string void init() { logging::add_file_log ( keywords::file_name = "sample_%N.log", keywords::format = "[%TimeStamp%]: %Message%" ); } //] int main(int, char*[]) { init(); logging::add_common_attributes(); using namespace logging::trivial; src::severity_logger< severity_level > 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"; return 0; }