15 #ifndef BASE_FAIRLOGGER_H_
16 #define BASE_FAIRLOGGER_H_
19 #include <fairlogger/Logger.h>
24 #define MESSAGE_ORIGIN __FILE__, CONVERTTOSTRING(__LINE__), __FUNCTION__
41 static const char*
const LogLevelString[] =
42 {
"FATAL",
"ERROR",
"WARNING",
"INFO",
"DEBUG",
"DEBUG1",
"DEBUG2",
"DEBUG3",
"DEBUG4"};
52 fair::Logger::SetConsoleSeverity(fConsoleSeverity);
54 fair::Logger::SetConsoleSeverity(fair::Severity::fatal);
60 fConsoleSeverity = severity;
61 fair::Logger::SetConsoleSeverity(fConsoleSeverity);
67 fair::Logger::SetFileSeverity(fLogFileSeverity);
69 fair::Logger::SetFileSeverity(fair::Severity::fatal);
75 fLogFileSeverity = severity;
76 fair::Logger::SetFileSeverity(fLogFileSeverity);
85 void SetColoredLog(
bool enabled) { fair::Logger::SetConsoleColor(enabled); }
91 deprecated(
"Use 'IsLogNeeded(fair::Severity severity)' or 'fair::Logger::Logging(const fair::Severity "
92 "severity)' or 'fair::Logger::Logging(const std::string& severityStr)'")));
94 void Fatal(
const char* file,
const char* line,
const char* func,
const char* format, ...)
96 void Error(const
char* file, const
char* line, const
char* func, const
char* format, ...)
97 __attribute__((deprecated("Use 'LOG(error) << content;' macro interface instead.")));
98 void Warning(const
char* file, const
char* line, const
char* func, const
char* format, ...)
99 __attribute__((deprecated("Use 'LOG(warn) << content;' macro interface instead.")));
100 void Info(const
char* file, const
char* line, const
char* func, const
char* format, ...)
101 __attribute__((deprecated("Use 'LOG(info) << content;' macro interface instead.")));
102 void Debug(const
char* file, const
char* line, const
char* func, const
char* format, ...)
103 __attribute__((deprecated("Use 'LOG(debug) << content;' macro interface instead.")));
104 void Debug1(const
char* file, const
char* line, const
char* func, const
char* format, ...)
105 __attribute__((deprecated("Use 'LOG(debug1) << content;' macro interface instead.")));
106 void Debug2(const
char* file, const
char* line, const
char* func, const
char* format, ...)
107 __attribute__((deprecated("Use 'LOG(debug2) << content;' macro interface instead.")));
108 void Debug3(const
char* file, const
char* line, const
char* func, const
char* format, ...)
109 __attribute__((deprecated("Use 'LOG(debug3) << content;' macro interface instead.")));
110 void Debug4(const
char* file, const
char* line, const
char* func, const
char* format, ...)
111 __attribute__((deprecated("Use 'LOG(debug4) << content;' macro interface instead.")));
114 deprecated("Line break is now added automatically by the LOG macro, this variable only adds empty space.")));
116 deprecated("Data is now flushed automatically by the LOG macro, this variable only adds empty space.")));
129 void Log(fair::Severity level,
136 const char* ConvertLogLevelToString(
FairLogLevel level)
const {
return LogLevelString[level]; }
138 static void LogFatalMessage();
140 void OpenLogFile() { fair::Logger::InitFileSink(fLogFileSeverity, fLogFileName,
false); }
142 void CloseLogFile() { fair::Logger::RemoveFileSink(); }
144 std::string fLogFileName;
145 std::string fLogFileSeverity;
146 std::string fConsoleSeverity;
149 int fBufferSizeNeeded;
150 std::vector<char> fDynamicBuffer;
151 char* fBufferPointer;
156 #define gLogger (FairLogger::GetLogger())
158 #endif // BASE_FAIRLOGGER_H_
void SetLogScreenLevel(const char *severity)
bool IsLogNeeded(FairLogLevel level) __attribute__((deprecated("Use 'IsLogNeeded(fair macro interface instead
void Debug4(const char *file, const char *line, const char *func, const char *format,...) __attribute__((deprecated("Use 'LOG(debug4) << content
void Warning(const char *file, const char *line, const char *func, const char *format,...) __attribute__((deprecated("Use 'LOG(warn) << content
void SetLogFileLevel(const char *severity)
void Debug1(const char *file, const char *line, const char *func, const char *format,...) __attribute__((deprecated("Use 'LOG(debug1) << content
void Error(const char *file, const char *line, const char *func, const char *format,...) __attribute__((deprecated("Use 'LOG(error) << content
void SetLogFileName(const std::string &name)
void Debug(const char *file, const char *line, const char *func, const char *format,...) __attribute__((deprecated("Use 'LOG(debug) << content
void SetLogToScreen(bool enabled)
void SetLogToFile(bool enabled)
static FairLogger * GetLogger()
static char const endl __attribute__((deprecated("Line break is now added automatically by the LOG macro, this variable only adds empty space.")))
bool IsLogNeeded(fair::Severity severity)
void Info(const char *file, const char *line, const char *func, const char *format,...) __attribute__((deprecated("Use 'LOG(info) << content
void Debug2(const char *file, const char *line, const char *func, const char *format,...) __attribute__((deprecated("Use 'LOG(debug2) << content
void Debug3(const char *file, const char *line, const char *func, const char *format,...) __attribute__((deprecated("Use 'LOG(debug3) << content
void SetScreenStreamToCerr(bool)
void SetLogVerbosityLevel(const char *verbosity)
void SetColoredLog(bool enabled)