24 const char FairLogger::endl =
' ';
25 const char FairLogger::flush =
' ';
27 FairLogger::FairLogger()
29 , fLogFileSeverity(
"info")
30 , fConsoleSeverity(
"info")
32 , fBufferSizeNeeded(-1)
33 , fDynamicBuffer(fBufferSize)
34 , fBufferPointer(&fDynamicBuffer[0])
36 fair::Logger::OnFatal(LogFatalMessage);
48 void FairLogger::Fatal(
const char* file,
const char* line,
const char* func,
const char* format, ...)
52 Log(fair::Severity::fatal, file, line, func, format, ap);
56 void FairLogger::Error(
const char* file,
const char* line,
const char* func,
const char* format, ...)
61 Log(fair::Severity::error, file, line, func, format, ap);
66 void FairLogger::Warning(
const char* file,
const char* line,
const char* func,
const char* format, ...)
71 Log(fair::Severity::warning, file, line, func, format, ap);
76 void FairLogger::Info(
const char* file,
const char* line,
const char* func,
const char* format, ...)
81 Log(fair::Severity::info, file, line, func, format, ap);
86 void FairLogger::Debug(
const char* file,
const char* line,
const char* func,
const char* format, ...)
91 Log(fair::Severity::debug, file, line, func, format, ap);
96 void FairLogger::Debug1(
const char* file,
const char* line,
const char* func,
const char* format, ...)
100 va_start(ap, format);
101 Log(fair::Severity::debug1, file, line, func, format, ap);
106 void FairLogger::Debug2(
const char* file,
const char* line,
const char* func,
const char* format, ...)
110 va_start(ap, format);
111 Log(fair::Severity::debug2, file, line, func, format, ap);
116 void FairLogger::Debug3(
const char* file,
const char* line,
const char* func,
const char* format, ...)
120 va_start(ap, format);
121 Log(fair::Severity::debug3, file, line, func, format, ap);
126 void FairLogger::Debug4(
const char* file,
const char* line,
const char* func,
const char* format, ...)
130 va_start(ap, format);
131 Log(fair::Severity::debug4, file, line, func, format, ap);
136 void FairLogger::Log(fair::Severity severity,
151 fBufferSizeNeeded = vsnprintf(fBufferPointer, fBufferSize, format, arglist);
160 if (fBufferSizeNeeded <= static_cast<int>(fBufferSize) && fBufferSizeNeeded >= 0) {
162 LOGD(severity, file, line, func) << std::string(fBufferPointer, static_cast<size_t>(fBufferSizeNeeded));
169 fBufferSize = (fBufferSizeNeeded > 0) ? (fBufferSizeNeeded + 1) : (fBufferSize * 2);
170 fDynamicBuffer.resize(fBufferSize);
178 void FairLogger::LogFatalMessage()
188 TString corefile =
"core_dump_";
189 int pid = gSystem->GetPid();
192 std::cerr <<
"For later analysis we write a core dump to " << corefile << std::endl;
194 if (freopen(corefile,
"w", stderr)) {
195 gSystem->StackTrace();
200 throw fair::FatalException(
"Fatal error occured. Exiting...");
void Debug4(const char *file, const char *line, const char *func, const char *format,...) __attribute__((deprecated("Use 'LOG(debug4) << content
ClassImp(FairEventBuilder)
void Warning(const char *file, const char *line, const char *func, const char *format,...) __attribute__((deprecated("Use 'LOG(warn) << content
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 Debug(const char *file, const char *line, const char *func, const char *format,...) __attribute__((deprecated("Use 'LOG(debug) << content
static FairLogger * GetLogger()
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