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 74 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 32 of file Logger.cpp.

32 {
33 el::Configurations conf = *el::Loggers::defaultConfigurations();
34
35 conf.setGlobally(el::ConfigurationType::Enabled, "true");
36 conf.setGlobally(el::ConfigurationType::Format, "%datetime{%Y-%M-%d %H:%m:%s} %tick %level %msg");
37 conf.setGlobally(el::ConfigurationType::ToFile, "false");
38 conf.setGlobally(el::ConfigurationType::ToStandardOutput, "true");
39 conf.setGlobally(el::ConfigurationType::SubsecondPrecision, "2");
40 conf.setGlobally(el::ConfigurationType::PerformanceTracking, "false");
41 conf.setGlobally(el::ConfigurationType::MaxLogFileSize, "2097152");
42 conf.setGlobally(el::ConfigurationType::LogFlushThreshold, "0");
43 conf.set(el::Level::Verbose, el::ConfigurationType::Format, "%datetime{%Y-%M-%d %H:%m:%s} %tick %msg");
44
45 el::Loggers::addFlag(el::LoggingFlag::DisableApplicationAbortOnFatalLog);
46 el::Loggers::addFlag(el::LoggingFlag::DisablePerformanceTrackingCheckpointComparison);
47 el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput);
48 el::Loggers::removeFlag(el::LoggingFlag::AllowVerboseIfModuleNotSpecified);
49
50 el::Loggers::setDefaultConfigurations(conf, true);
51
53 setLogLevel(0);
54 }
static void setVerboseLevel(int level)
Definition Logger.cpp:99
static void setLogLevel(int level)
Definition Logger.cpp:62

References setLogLevel(), and setVerboseLevel().

Referenced by utils::makeApp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ logToFile()

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

Definition at line 105 of file Logger.cpp.

105 {
106 el::Configurations conf = *el::Loggers::defaultConfigurations();
107
108 conf.setGlobally(el::ConfigurationType::Filename, logFile);
109 conf.setGlobally(el::ConfigurationType::ToFile, "true");
110
111 el::Loggers::setDefaultConfigurations(conf, true);
112 }

◆ setCustomFormatSpec()

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

Definition at line 56 of file Logger.cpp.

56 {
57 el::Helpers::installCustomFormatSpecifier(el::CustomFormatSpecifier(format, resolver));
58 }

◆ setLogLevel()

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

Definition at line 62 of file Logger.cpp.

62 {
63 el::Configurations conf = *el::Loggers::defaultConfigurations();
64
65 conf.set(el::Level::Trace, el::ConfigurationType::Enabled, "false"); // trace method/function calling
66 conf.set(el::Level::Debug, el::ConfigurationType::Enabled, "false"); // typical assert messages - but we can go on
67 conf.set(el::Level::Info, el::ConfigurationType::Enabled, "false"); // additional infos - what 's going on
68 conf.set(el::Level::Warning, el::ConfigurationType::Enabled, "false"); // not that serious but mentioning
69 conf.set(el::Level::Error, el::ConfigurationType::Enabled, "false"); // serious errors - but we can go on
70 conf.set(el::Level::Fatal, el::ConfigurationType::Enabled, "false"); // asserts - stop - we can not go on
71
72 switch (level) {
73 case 6:
74 conf.set(el::Level::Trace, el::ConfigurationType::Enabled, "true");
75 [[fallthrough]];
76 case 5:
77 conf.set(el::Level::Debug, el::ConfigurationType::Enabled, "true");
78 [[fallthrough]];
79 case 4:
80 conf.set(el::Level::Info, el::ConfigurationType::Enabled, "true");
81 [[fallthrough]];
82 case 3:
83 conf.set(el::Level::Warning, el::ConfigurationType::Enabled, "true");
84 [[fallthrough]];
85 case 2:
86 conf.set(el::Level::Error, el::ConfigurationType::Enabled, "true");
87 [[fallthrough]];
88 case 1:
89 conf.set(el::Level::Fatal, el::ConfigurationType::Enabled, "true");
90 [[fallthrough]];
91 case 0:
92 [[fallthrough]];
93 default:;
94 }
95
96 el::Loggers::setDefaultConfigurations(conf, true);
97 }

Referenced by init().

Here is the caller graph for this function:

◆ setQuiet()

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

Definition at line 114 of file Logger.cpp.

114 {
115 el::Configurations conf = *el::Loggers::defaultConfigurations();
116
117 conf.setGlobally(el::ConfigurationType::ToStandardOutput, quiet ? "false" : "true");
118
119 el::Loggers::setDefaultConfigurations(conf, true);
120 }

Referenced by utils::Config::parse2().

Here is the caller graph for this function:

◆ setVerboseLevel()

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

Definition at line 99 of file Logger.cpp.

99 {
100 if (level >= 0) {
101 el::Loggers::setVerboseLevel(static_cast<el::base::type::VerboseLevel>(level));
102 }
103 }

Referenced by init().

Here is the caller graph for this function:

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