Skip to content

Commit

Permalink
Set InfoLogger message levels in addition to severity
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrohr committed May 15, 2023
1 parent 06614ef commit 1144dce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/common/base/DataDistLogger.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ std::thread impl::DataDistLoggerCtx::sRateUpdateThread;
std::thread impl::DataDistLoggerCtx::mInfoLoggerThread;


std::unique_ptr<ConcurrentFifo<std::tuple<AliceO2::InfoLogger::InfoLogger::Severity, std::string>>>
std::unique_ptr<ConcurrentFifo<std::tuple<AliceO2::InfoLogger::InfoLogger::InfoLoggerMessageOption, std::string>>>
DataDistLogger::sInfoLogQueue = nullptr;


Expand Down
21 changes: 11 additions & 10 deletions src/common/base/DataDistLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <fairlogger/Logger.h>

#include <InfoLogger/InfoLogger.hxx>
#include <InfoLogger/InfoLoggerMacros.hxx>
#include <boost/program_options/options_description.hpp>

#if defined(__linux__)
Expand Down Expand Up @@ -123,7 +124,7 @@ class DataDistLogger {

if (InfoLogEnabled(mSeverity)) {
sInfoLogQueue->push_capacity(cInfoLoggerQueueSize,
std::make_tuple(AliceO2::InfoLogger::InfoLogger::Severity::Fatal,
std::make_tuple(LogFatalOps,
std::string(std::string_view(mLogMessage.begin(), mLogMessage.size()))
));
}
Expand All @@ -135,7 +136,7 @@ class DataDistLogger {

if (InfoLogEnabled(mSeverity)) {
sInfoLogQueue->push_capacity(cInfoLoggerQueueSize,
std::make_tuple(AliceO2::InfoLogger::InfoLogger::Severity::Error,
std::make_tuple(LogErrorOps,
std::string(std::string_view(mLogMessage.begin(), mLogMessage.size()))
));
}
Expand All @@ -148,7 +149,7 @@ class DataDistLogger {

if (InfoLogEnabled(mSeverity)) {
sInfoLogQueue->push_capacity(cInfoLoggerQueueSize,
std::make_tuple(AliceO2::InfoLogger::InfoLogger::Severity::Warning,
std::make_tuple(LogWarningSupport,
std::string(std::string_view(mLogMessage.begin(), mLogMessage.size()))
));
}
Expand All @@ -161,7 +162,7 @@ class DataDistLogger {

if (InfoLogEnabled(mSeverity)) {
sInfoLogQueue->push_capacity(cInfoLoggerQueueSize,
std::make_tuple(AliceO2::InfoLogger::InfoLogger::Severity::Info,
std::make_tuple(LogInfoDevel,
std::string(std::string_view(mLogMessage.begin(), mLogMessage.size()))
));
}
Expand All @@ -174,7 +175,7 @@ class DataDistLogger {

if (InfoLogEnabled(mSeverity)) {
sInfoLogQueue->push_capacity(cInfoLoggerQueueSize,
std::make_tuple(AliceO2::InfoLogger::InfoLogger::Severity::Info,
std::make_tuple(LogInfoDevel,
std::string(std::string_view(mLogMessage.begin(), mLogMessage.size()))
));
}
Expand All @@ -187,7 +188,7 @@ class DataDistLogger {

if (InfoLogEnabled(mSeverity)) {
sInfoLogQueue->push_capacity(cInfoLoggerQueueSize,
std::make_tuple(AliceO2::InfoLogger::InfoLogger::Severity::Debug,
std::make_tuple(LogDebugDevel,
std::string(std::string_view(mLogMessage.begin(), mLogMessage.size()))
));
}
Expand All @@ -200,7 +201,7 @@ class DataDistLogger {

if (InfoLogEnabled(mSeverity)) {
sInfoLogQueue->push_capacity(cInfoLoggerQueueSize,
std::make_tuple(AliceO2::InfoLogger::InfoLogger::Severity::Debug,
std::make_tuple(LogDebugTrace,
std::string(std::string_view(mLogMessage.begin(), mLogMessage.size()))
));
}
Expand Down Expand Up @@ -233,7 +234,7 @@ class DataDistLogger {
bool LogEnabled(const DataDistSeverity pSevVal) { return (InfoLogEnabled(pSevVal) || StdoutEnabled(pSevVal)); }

// InfoLogger queue
static std::unique_ptr<ConcurrentFifo<std::tuple<AliceO2::InfoLogger::InfoLogger::Severity, std::string>>> sInfoLogQueue;
static std::unique_ptr<ConcurrentFifo<std::tuple<AliceO2::InfoLogger::InfoLogger::InfoLoggerMessageOption, std::string>>> sInfoLogQueue;

private:

Expand Down Expand Up @@ -345,7 +346,7 @@ struct DataDistLoggerCtx {
sRunning = true;

DataDistLogger::sInfoLogQueue =
std::make_unique<ConcurrentFifo<std::tuple<AliceO2::InfoLogger::InfoLogger::Severity, std::string>>>();
std::make_unique<ConcurrentFifo<std::tuple<AliceO2::InfoLogger::InfoLogger::InfoLoggerMessageOption, std::string>>>();

fair::Logger::SetConsoleSeverity(fair::Severity::nolog);
fair::Logger::SetFileSeverity(fair::Severity::nolog);
Expand Down Expand Up @@ -374,7 +375,7 @@ struct DataDistLoggerCtx {
pthread_setname_np(pthread_self(), "infolog");
#endif

std::tuple<AliceO2::InfoLogger::InfoLogger::Severity, std::string> lLogVal;
std::tuple<AliceO2::InfoLogger::InfoLogger::InfoLoggerMessageOption, std::string> lLogVal;

while (sRunning) {
if( DataDistLogger::sInfoLogQueue->pop(lLogVal) ){
Expand Down

0 comments on commit 1144dce

Please sign in to comment.