2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
42#ifndef DOXYGEN_SHOULD_SKIP_THIS
44#include "log/Logger.h"
50INITIALIZE_EASYLOGGINGPP
55 el::Configurations conf = *el::Loggers::defaultConfigurations();
57 conf.setGlobally(el::ConfigurationType::Enabled,
"true");
58 conf.setGlobally(el::ConfigurationType::Format,
"%datetime{%Y-%M-%d %H:%m:%s} %tick %level %msg");
59 conf.setGlobally(el::ConfigurationType::ToFile,
"false");
60 conf.setGlobally(el::ConfigurationType::ToStandardOutput,
"true");
61 conf.setGlobally(el::ConfigurationType::SubsecondPrecision,
"2");
62 conf.setGlobally(el::ConfigurationType::PerformanceTracking,
"false");
63 conf.setGlobally(el::ConfigurationType::MaxLogFileSize,
"2097152");
64 conf.setGlobally(el::ConfigurationType::LogFlushThreshold,
"0");
65 conf.set(el::Level::Verbose, el::ConfigurationType::Format,
"%datetime{%Y-%M-%d %H:%m:%s} %tick %msg");
67 el::Loggers::addFlag(el::LoggingFlag::DisableApplicationAbortOnFatalLog);
68 el::Loggers::addFlag(el::LoggingFlag::DisablePerformanceTrackingCheckpointComparison);
69 el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput);
70 el::Loggers::removeFlag(el::LoggingFlag::AllowVerboseIfModuleNotSpecified);
72 el::Loggers::setDefaultConfigurations(conf,
true);
79 el::Helpers::installCustomFormatSpecifier(el::CustomFormatSpecifier(format, resolver));
85 el::Configurations conf = *el::Loggers::defaultConfigurations();
87 conf.set(el::Level::Trace, el::ConfigurationType::Enabled,
"false");
88 conf.set(el::Level::Debug, el::ConfigurationType::Enabled,
"false");
89 conf.set(el::Level::Info, el::ConfigurationType::Enabled,
"false");
90 conf.set(el::Level::Warning, el::ConfigurationType::Enabled,
"false");
91 conf.set(el::Level::Error, el::ConfigurationType::Enabled,
"false");
92 conf.set(el::Level::Fatal, el::ConfigurationType::Enabled,
"false");
96 conf.set(el::Level::Trace, el::ConfigurationType::Enabled,
"true");
99 conf.set(el::Level::Debug, el::ConfigurationType::Enabled,
"true");
102 conf.set(el::Level::Info, el::ConfigurationType::Enabled,
"true");
105 conf.set(el::Level::Warning, el::ConfigurationType::Enabled,
"true");
108 conf.set(el::Level::Error, el::ConfigurationType::Enabled,
"true");
111 conf.set(el::Level::Fatal, el::ConfigurationType::Enabled,
"true");
118 el::Loggers::setDefaultConfigurations(conf,
true);
123 el::Loggers::setVerboseLevel(
static_cast<el::base::type::VerboseLevel>(level));
128 el::Configurations conf = *el::Loggers::defaultConfigurations();
130 conf.setGlobally(el::ConfigurationType::Filename, logFile);
131 conf.setGlobally(el::ConfigurationType::ToFile,
"true");
133 el::Loggers::setDefaultConfigurations(conf,
true);
137 el::Configurations conf = *el::Loggers::defaultConfigurations();
139 conf.setGlobally(el::ConfigurationType::ToStandardOutput, quiet ?
"false" :
"true");
141 el::Loggers::setDefaultConfigurations(conf,
true);
146std::ostream&
Color::operator<<(std::ostream& os,
Code code) {
147 return os <<
"\033[" <<
static_cast<
int>(code) <<
"m";
static void logToFile(const std::string &logFile)
static void setVerboseLevel(int level)
static void setCustomFormatSpec(const char *format, const el::FormatSpecifierValueResolver &resolver)
static void setLogLevel(int level)
static void setQuiet(bool quiet=true)