tutorial_trivial_flt.cpp 965 B

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