SNode.C
Loading...
Searching...
No Matches
logger::Logger Class Reference

#include <Logger.h>

Collaboration diagram for logger::Logger:

Public Member Functions

 Logger ()=delete
 
 ~Logger ()=delete
 

Static Public Member Functions

static void init ()
 
static void setLogLevel (int level)
 
static void setVerboseLevel (int level)
 
static void logToFile (const std::string &logFile)
 
static void setQuiet (bool quiet=true)
 
static void setCustomFormatSpec (const char *format, const el::FormatSpecifierValueResolver &resolver)
 

Detailed Description

Definition at line 96 of file Logger.h.

Constructor & Destructor Documentation

◆ Logger()

logger::Logger::Logger ( )
delete

◆ ~Logger()

logger::Logger::~Logger ( )
delete

Member Function Documentation

◆ init()

void logger::Logger::init ( )
static

Definition at line 54 of file Logger.cpp.

54 {
55 el::Configurations conf = *el::Loggers::defaultConfigurations();
56
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");
66
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);
71
72 el::Loggers::setDefaultConfigurations(conf, true);
73
75 setLogLevel(0);
76 }
static void setVerboseLevel(int level)
Definition Logger.cpp:121
static void setLogLevel(int level)
Definition Logger.cpp:84

◆ logToFile()

void logger::Logger::logToFile ( const std::string &  logFile)
static

Definition at line 127 of file Logger.cpp.

127 {
128 el::Configurations conf = *el::Loggers::defaultConfigurations();
129
130 conf.setGlobally(el::ConfigurationType::Filename, logFile);
131 conf.setGlobally(el::ConfigurationType::ToFile, "true");
132
133 el::Loggers::setDefaultConfigurations(conf, true);
134 }

◆ setCustomFormatSpec()

void logger::Logger::setCustomFormatSpec ( const char *  format,
const el::FormatSpecifierValueResolver &  resolver 
)
static

Definition at line 78 of file Logger.cpp.

78 {
79 el::Helpers::installCustomFormatSpecifier(el::CustomFormatSpecifier(format, resolver));
80 }

◆ setLogLevel()

void logger::Logger::setLogLevel ( int  level)
static

Definition at line 84 of file Logger.cpp.

84 {
85 el::Configurations conf = *el::Loggers::defaultConfigurations();
86
87 conf.set(el::Level::Trace, el::ConfigurationType::Enabled, "false"); // trace method/function calling
88 conf.set(el::Level::Debug, el::ConfigurationType::Enabled, "false"); // typical assert messages - but we can go on
89 conf.set(el::Level::Info, el::ConfigurationType::Enabled, "false"); // additional infos - what 's going on
90 conf.set(el::Level::Warning, el::ConfigurationType::Enabled, "false"); // not that serious but mentioning
91 conf.set(el::Level::Error, el::ConfigurationType::Enabled, "false"); // serious errors - but we can go on
92 conf.set(el::Level::Fatal, el::ConfigurationType::Enabled, "false"); // asserts - stop - we can not go on
93
94 switch (level) {
95 case 6:
96 conf.set(el::Level::Trace, el::ConfigurationType::Enabled, "true");
97 [[fallthrough]];
98 case 5:
99 conf.set(el::Level::Debug, el::ConfigurationType::Enabled, "true");
100 [[fallthrough]];
101 case 4:
102 conf.set(el::Level::Info, el::ConfigurationType::Enabled, "true");
103 [[fallthrough]];
104 case 3:
105 conf.set(el::Level::Warning, el::ConfigurationType::Enabled, "true");
106 [[fallthrough]];
107 case 2:
108 conf.set(el::Level::Error, el::ConfigurationType::Enabled, "true");
109 [[fallthrough]];
110 case 1:
111 conf.set(el::Level::Fatal, el::ConfigurationType::Enabled, "true");
112 [[fallthrough]];
113 case 0:
114 [[fallthrough]];
115 default:;
116 }
117
118 el::Loggers::setDefaultConfigurations(conf, true);
119 }

◆ setQuiet()

void logger::Logger::setQuiet ( bool  quiet = true)
static

Definition at line 136 of file Logger.cpp.

136 {
137 el::Configurations conf = *el::Loggers::defaultConfigurations();
138
139 conf.setGlobally(el::ConfigurationType::ToStandardOutput, quiet ? "false" : "true");
140
141 el::Loggers::setDefaultConfigurations(conf, true);
142 }

◆ setVerboseLevel()

void logger::Logger::setVerboseLevel ( int  level)
static

Definition at line 121 of file Logger.cpp.

121 {
122 if (level >= 0) {
123 el::Loggers::setVerboseLevel(static_cast<el::base::type::VerboseLevel>(level));
124 }
125 }

The documentation for this class was generated from the following files: