• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <boost/log/core.hpp>
9 #include <boost/log/trivial.hpp>
10 #include <boost/log/expressions.hpp>
11 
12 namespace logging = boost::log;
13 
14 //[ example_tutorial_trivial_with_filtering
init()15 void init()
16 {
17     logging::core::get()->set_filter
18     (
19         logging::trivial::severity >= logging::trivial::info
20     );
21 }
22 
main(int,char * [])23 int main(int, char*[])
24 {
25     init();
26 
27     BOOST_LOG_TRIVIAL(trace) << "A trace severity message";
28     BOOST_LOG_TRIVIAL(debug) << "A debug severity message";
29     BOOST_LOG_TRIVIAL(info) << "An informational severity message";
30     BOOST_LOG_TRIVIAL(warning) << "A warning severity message";
31     BOOST_LOG_TRIVIAL(error) << "An error severity message";
32     BOOST_LOG_TRIVIAL(fatal) << "A fatal severity message";
33 
34     return 0;
35 }
36 //]
37