]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/log/example/doc/tutorial_fmt_string.cpp
2 * Copyright Andrey Semashev 2007 - 2015.
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
8 #include <boost/log/trivial.hpp>
9 #include <boost/log/sources/severity_logger.hpp>
10 #include <boost/log/sources/record_ostream.hpp>
11 #include <boost/log/utility/setup/file.hpp>
12 #include <boost/log/utility/setup/common_attributes.hpp>
14 namespace logging
= boost::log
;
15 namespace src
= boost::log::sources
;
16 namespace keywords
= boost::log::keywords
;
18 //[ example_tutorial_formatters_string
23 keywords::file_name
= "sample_%N.log",
24 keywords::format
= "[%TimeStamp%]: %Message%"
29 int main(int, char*[])
32 logging::add_common_attributes();
34 using namespace logging::trivial
;
35 src::severity_logger
< severity_level
> lg
;
37 BOOST_LOG_SEV(lg
, trace
) << "A trace severity message";
38 BOOST_LOG_SEV(lg
, debug
) << "A debug severity message";
39 BOOST_LOG_SEV(lg
, info
) << "An informational severity message";
40 BOOST_LOG_SEV(lg
, warning
) << "A warning severity message";
41 BOOST_LOG_SEV(lg
, error
) << "An error severity message";
42 BOOST_LOG_SEV(lg
, fatal
) << "A fatal severity message";