Advertisement
Guest User

Untitled

a guest
Feb 26th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. #include <boost/log/core.hpp>
  2. #include <boost/log/expressions.hpp>
  3. #include <boost/log/sinks/text_file_backend.hpp>
  4. #include <boost/log/sources/record_ostream.hpp>
  5. #include <boost/log/sources/severity_logger.hpp>
  6. #include <boost/log/trivial.hpp>
  7. #include <boost/log/utility/setup/common_attributes.hpp>
  8. #include <boost/log/utility/setup/console.hpp>
  9. #include <boost/log/utility/setup/file.hpp>
  10.  
  11. namespace is = ImageStitching;
  12. namespace logging = boost::log;
  13. namespace src = boost::log::sources;
  14. namespace sinks = boost::log::sinks;
  15. namespace keywords = boost::log::keywords;
  16.  
  17. void log_init() {
  18. logging::register_simple_formatter_factory<
  19. boost::log::trivial::severity_level, char>("Severity");
  20.  
  21. logging::add_file_log(
  22. keywords::target = "logs/", keywords::file_name = "%y%m%d_%3N.log",
  23. keywords::rotation_size = 10 * 1024 * 1024,
  24. keywords::scan_method = sinks::file::scan_matching,
  25. keywords::format = "[%TimeStamp%][%Severity%]: %Message%");
  26.  
  27. logging::add_console_log(std::cout,
  28. boost::log::keywords::format = ">> %Message%");
  29.  
  30. logging::core::get()->set_filter(logging::trivial::severity >=
  31. logging::trivial::info);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement