MCPcopy Create free account
hub / github.com/OpenCppCoverage/OpenCppCoverage / InitConsoleAndFileLog

Function InitConsoleAndFileLog

Tools/Log.cpp:48–70  ·  view source on GitHub ↗

-------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

46
47 //-------------------------------------------------------------------------
48 void InitConsoleAndFileLog(const std::filesystem::path& logPath)
49 {
50 boost::log::add_common_attributes();
51
52 auto fileSink = logging::add_file_log(logPath.wstring(),
53 boost::log::keywords::format =
54 expr::stream
55 << "[" << expr::format_date_time< boost::posix_time::ptime >("TimeStamp", "%Y-%m-%d %H:%M:%S")
56 << "] [" << logging::trivial::severity
57 << "] " << expr::message);
58
59 auto consoleSink = logging::add_console_log(std::clog,
60 boost::log::keywords::format =
61 expr::stream
62 << "[" << logging::trivial::severity
63 << "] " << expr::message
64 );
65
66 // Set correct endocing for special char
67 auto loc = boost::locale::generator()("en_US.UTF-8");
68 fileSink->imbue(loc);
69 consoleSink->imbue(loc);
70 }
71
72 //-------------------------------------------------------------------------
73 void SetLoggerMinSeverity(boost::log::trivial::severity_level minSeverity)

Callers 1

InitLoggerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected