Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Framework/Core/include/Framework/LogParsingHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ struct LogParsingHelpers {
enum struct LogLevel {
Debug,
Info,
Important,
Warning,
Alarm,
Error,
Critical,
Fatal,
Unknown,
Size
Expand Down
6 changes: 6 additions & 0 deletions Framework/Core/src/LogParsingHelpers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ namespace o2::framework
char const* const LogParsingHelpers::LOG_LEVELS[(int)LogParsingHelpers::LogLevel::Size] = {
"DEBUG",
"INFO",
"IMPORTANT",
"WARNING",
"ALARM",
"ERROR",
"CRITICAL",
"FATAL",
"UNKNOWN"};
using LogLevel = o2::framework::LogParsingHelpers::LogLevel;
Expand Down Expand Up @@ -59,12 +61,16 @@ LogLevel LogParsingHelpers::parseTokenLevel(std::string_view const s)
} else if (s.compare(LABELPOS, 7, "[INFO] ") == 0 ||
s.compare(LABELPOS, 8, "[STATE] ") == 0) {
return LogLevel::Info;
} else if (s.compare(LABELPOS, 12, "[IMPORTANT] ") == 0) {
return LogLevel::Important;
} else if (s.compare(LABELPOS, 7, "[WARN] ") == 0) {
return LogLevel::Warning;
} else if (s.compare(LABELPOS, 8, "[ALARM] ") == 0) {
return LogLevel::Alarm;
} else if (s.compare(LABELPOS, 8, "[ERROR] ") == 0) {
return LogLevel::Error;
} else if (s.compare(LABELPOS, 11, "[CRITICAL] ") == 0) {
return LogLevel::Critical;
} else if (s.compare(LABELPOS, 8, "[FATAL] ") == 0) {
return LogLevel::Fatal;
}
Expand Down
4 changes: 4 additions & 0 deletions Framework/Core/src/runDataProcessing.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2141,6 +2141,8 @@ int runStateMachine(DataProcessorSpecs const& workflow,
info.logLevel = LogParsingHelpers::LogLevel::Info;
} else if ((*logLevelIt).compare("alarm") == 0) {
info.logLevel = LogParsingHelpers::LogLevel::Alarm;
} else if ((*logLevelIt).compare("critical") == 0) {
info.logLevel = LogParsingHelpers::LogLevel::Critical;
} else if ((*logLevelIt).compare("fatal") == 0) {
info.logLevel = LogParsingHelpers::LogLevel::Fatal;
}
Expand Down Expand Up @@ -3159,6 +3161,8 @@ int doMain(int argc, char** argv, o2::framework::WorkflowSpec const& workflow,
fair::Logger::SetConsoleSeverity(fair::Severity::important);
} else if (logLevel == "alarm") {
fair::Logger::SetConsoleSeverity(fair::Severity::alarm);
} else if (logLevel == "critical") {
fair::Logger::SetConsoleSeverity(fair::Severity::critical);
} else if (logLevel == "fatal") {
fair::Logger::SetConsoleSeverity(fair::Severity::fatal);
} else {
Expand Down
18 changes: 10 additions & 8 deletions Framework/DataTakingSupport/src/Plugin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ auto createInfoLoggerSinkHelper(InfoLogger* logger, InfoLoggerContext* ctx)
severity = InfoLogger::Severity::Fatal;
level = 1;
break;
case fair::Severity::critical:
severity = InfoLogger::Severity::Error;
level = 1;
break;
case fair::Severity::error:
severity = InfoLogger::Severity::Error;
level = 2;
Expand Down Expand Up @@ -128,15 +132,13 @@ auto createInfoLoggerSinkHelper(InfoLogger* logger, InfoLoggerContext* ctx)
return;
}

InfoLogger::InfoLoggerMessageOption opt = {
severity,
level,
InfoLogger::undefinedMessageOption.errorCode,
metadata.file.data(),
atoi(metadata.line.data())};

if (logger) {
logger->log(opt, *ctx, "%s", content.c_str());
logger->log({severity,
level,
InfoLogger::undefinedMessageOption.errorCode,
std::string(metadata.file).c_str(),
atoi(std::string(metadata.line).c_str())},
*ctx, "%s", content.c_str());
}
};
};
Expand Down
10 changes: 10 additions & 0 deletions Framework/Foundation/include/Framework/Signpost.h
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,16 @@ void o2_debug_log_set_stacktrace(_o2_log_t* log, int stacktrace)
O2_LOG_MACRO_RAW(warn, remove_engineering_type(format).data(), ##__VA_ARGS__); \
})

// Similar to the above, however it will also print a normal critical message regardless of the signpost being enabled or not.
#define O2_SIGNPOST_EVENT_EMIT_CRITICAL(log, id, name, format, ...) __extension__({ \
if (O2_BUILTIN_UNLIKELY(O2_SIGNPOST_ENABLED_MAC(log))) { \
O2_SIGNPOST_EVENT_EMIT_MAC(log, id, name, format, ##__VA_ARGS__); \
} else if (O2_BUILTIN_UNLIKELY(private_o2_log_##log->stacktrace)) { \
_o2_signpost_event_emit(private_o2_log_##log, id, name, remove_engineering_type(format).data(), ##__VA_ARGS__); \
} \
O2_LOG_MACRO_RAW(critical, remove_engineering_type(format).data(), ##__VA_ARGS__); \
})

#define O2_SIGNPOST_START(log, id, name, format, ...) \
if (O2_BUILTIN_UNLIKELY(O2_SIGNPOST_ENABLED_MAC(log))) { \
O2_SIGNPOST_START_MAC(log, id, name, format, ##__VA_ARGS__); \
Expand Down
14 changes: 14 additions & 0 deletions Framework/GUISupport/src/FrameworkGUIDebugger.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ ImVec4 colorForLogLevel(LogParsingHelpers::LogLevel logLevel)
switch (logLevel) {
case LogParsingHelpers::LogLevel::Info:
return PaletteHelpers::GREEN;
case LogParsingHelpers::LogLevel::Important:
return PaletteHelpers::GREEN;
case LogParsingHelpers::LogLevel::Debug:
return PaletteHelpers::WHITE;
case LogParsingHelpers::LogLevel::Alarm:
Expand All @@ -77,6 +79,8 @@ ImVec4 colorForLogLevel(LogParsingHelpers::LogLevel logLevel)
return PaletteHelpers::DARK_YELLOW;
case LogParsingHelpers::LogLevel::Error:
return PaletteHelpers::RED;
case LogParsingHelpers::LogLevel::Critical:
return PaletteHelpers::RED;
case LogParsingHelpers::LogLevel::Fatal:
return PaletteHelpers::RED;
case LogParsingHelpers::LogLevel::Unknown:
Expand Down Expand Up @@ -977,11 +981,21 @@ void pushWindowColorDueToStatus(const DeviceInfo& info)
return;
}
switch (info.maxLogLevel) {
case LogLevel::Critical:
ImGui::PushStyleColor(ImGuiCol_TitleBg, PaletteHelpers::SHADED_RED);
ImGui::PushStyleColor(ImGuiCol_TitleBgActive, PaletteHelpers::RED);
ImGui::PushStyleColor(ImGuiCol_TitleBgCollapsed, PaletteHelpers::SHADED_RED);
break;
case LogLevel::Error:
ImGui::PushStyleColor(ImGuiCol_TitleBg, PaletteHelpers::SHADED_RED);
ImGui::PushStyleColor(ImGuiCol_TitleBgActive, PaletteHelpers::RED);
ImGui::PushStyleColor(ImGuiCol_TitleBgCollapsed, PaletteHelpers::SHADED_RED);
break;
case LogLevel::Alarm:
ImGui::PushStyleColor(ImGuiCol_TitleBg, PaletteHelpers::SHADED_YELLOW);
ImGui::PushStyleColor(ImGuiCol_TitleBgActive, PaletteHelpers::YELLOW);
ImGui::PushStyleColor(ImGuiCol_TitleBgCollapsed, PaletteHelpers::SHADED_YELLOW);
break;
case LogLevel::Warning:
ImGui::PushStyleColor(ImGuiCol_TitleBg, PaletteHelpers::SHADED_YELLOW);
ImGui::PushStyleColor(ImGuiCol_TitleBgActive, PaletteHelpers::YELLOW);
Expand Down
8 changes: 8 additions & 0 deletions Framework/GUISupport/src/FrameworkGUIDevicesGraph.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -694,10 +694,18 @@ void showTopologyNodeGraph(WorkspaceGUIState& state,
ImGui::BeginGroup(); // Lock horizontal position
ImGui::TextUnformatted(node->Name);
switch (info.maxLogLevel) {
case LogLevel::Critical:
ImGui::SameLine();
ImGui::TextColored(ERROR_MESSAGE_COLOR, "%s", ICON_FA_EXCLAMATION_CIRCLE);
break;
case LogLevel::Error:
ImGui::SameLine();
ImGui::TextColored(ERROR_MESSAGE_COLOR, "%s", ICON_FA_EXCLAMATION_CIRCLE);
break;
case LogLevel::Alarm:
ImGui::SameLine();
ImGui::TextColored(WARNING_MESSAGE_COLOR, "%s", ICON_FA_EXCLAMATION_TRIANGLE);
break;
case LogLevel::Warning:
ImGui::SameLine();
ImGui::TextColored(WARNING_MESSAGE_COLOR, "%s", ICON_FA_EXCLAMATION_TRIANGLE);
Expand Down
4 changes: 4 additions & 0 deletions Framework/Utils/include/DPLUtils/DPLRawParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ class DPLRawParser
LOG(warn) << msg << (*this->mInputIterator).spec->binding << " : " << e.what();
} else if (this->mSeverity == fair::Severity::fatal) {
LOG(fatal) << msg << (*this->mInputIterator).spec->binding << " : " << e.what();
} else if (this->mSeverity == fair::Severity::critical) {
LOG(critical) << msg << (*this->mInputIterator).spec->binding << " : " << e.what();
} else if (this->mSeverity == fair::Severity::error) {
LOG(error) << msg << (*this->mInputIterator).spec->binding << " : " << e.what();
} else if (this->mSeverity == fair::Severity::info) {
LOG(info) << msg << (*this->mInputIterator).spec->binding << " : " << e.what();
} else {
Expand Down
4 changes: 4 additions & 0 deletions GPU/GPUTracking/Definitions/GPULogging.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#define GPUWarning(...)
#define GPUAlarm(...)
#define GPUError(...)
#define GPUCritical(...)
#define GPUFatal(...)
#elif defined(GPUCA_STANDALONE) && !defined(GPUCA_GPUCODE_DEVICE) && !defined(GPUCA_NO_FMT)
#include <cstdio>
Expand All @@ -38,6 +39,7 @@
fmt::fprintf(stderr, string "\n", ##__VA_ARGS__); \
}
#define GPUError(...) GPUWarning(__VA_ARGS__)
#define GPUCritical(...) GPUWarning(__VA_ARGS__)
#define GPUAlarm(...) GPUWarning(__VA_ARGS__)
#define GPUFatal(string, ...) \
{ \
Expand All @@ -64,6 +66,7 @@
}
#define GPUAlarm(...) GPUWarning(__VA_ARGS__)
#define GPUError(...) GPUWarning(__VA_ARGS__)
#define GPUCritical(...) GPUWarning(__VA_ARGS__)
#define GPUFatal(string, ...) \
{ \
fprintf(stderr, string "\n", __VA_ARGS__); \
Expand All @@ -78,6 +81,7 @@
#define GPUWarning(...) LOGF(warning, __VA_ARGS__)
#define GPUAlarm(...) LOGF(alarm, __VA_ARGS__)
#define GPUError(...) LOGF(error, __VA_ARGS__)
#define GPUCritical(...) LOGF(critical, __VA_ARGS__)
#define GPUFatal(...) LOGF(fatal, __VA_ARGS__)
#endif

Expand Down