]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/log/example/trivial/main.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / log / example / trivial / main.cpp
CommitLineData
7c673cae
FG
1/*
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)
6 */
7/*!
8 * \file main.cpp
9 * \author Andrey Semashev
10 * \date 07.11.2009
11 *
12 * \brief An example of trivial logging.
13 */
14
15// #define BOOST_ALL_DYN_LINK 1
16// #define BOOST_LOG_DYN_LINK 1
17
18#include <boost/log/trivial.hpp>
19#include <boost/log/core.hpp>
20#include <boost/log/expressions.hpp>
21
22int main(int argc, char* argv[])
23{
24 // Trivial logging: all log records are written into a file
25 BOOST_LOG_TRIVIAL(trace) << "A trace severity message";
26 BOOST_LOG_TRIVIAL(debug) << "A debug severity message";
27 BOOST_LOG_TRIVIAL(info) << "An informational severity message";
28 BOOST_LOG_TRIVIAL(warning) << "A warning severity message";
29 BOOST_LOG_TRIVIAL(error) << "An error severity message";
30 BOOST_LOG_TRIVIAL(fatal) << "A fatal severity message";
31
32 // Filtering can also be applied
33 using namespace boost::log;
34
35 core::get()->set_filter
36 (
37 trivial::severity >= trivial::info
38 );
39
40 // Now the first two lines will not pass the filter
41 BOOST_LOG_TRIVIAL(trace) << "A trace severity message";
42 BOOST_LOG_TRIVIAL(debug) << "A debug severity message";
43 BOOST_LOG_TRIVIAL(info) << "An informational severity message";
44 BOOST_LOG_TRIVIAL(warning) << "A warning severity message";
45 BOOST_LOG_TRIVIAL(error) << "An error severity message";
46 BOOST_LOG_TRIVIAL(fatal) << "A fatal severity message";
47
48 return 0;
49}