Skip to content

Commit 8177b64

Browse files
committed
fairmq logger
1 parent 1114392 commit 8177b64

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/mainReadout.cxx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
#endif
4545

4646

47+
#ifdef WITH_FAIRMQ
48+
#include <fairmq/FairMQLogger.h>
49+
#endif
50+
4751

4852
using namespace AliceO2::InfoLogger;
4953
using namespace AliceO2::Common;
@@ -99,6 +103,34 @@ int main(int argc, char* argv[])
99103
theLog.log("Optional built features enabled:");
100104
#ifdef WITH_FAIRMQ
101105
theLog.log("FAIRMQ : yes");
106+
fair::Logger::SetConsoleColor(true);
107+
fair::Logger::SetConsoleSeverity("nolog");
108+
fair::Logger::AddCustomSink("infoLogger", "trace", [&](const std::string& content, // log content
109+
const fair::LogMetaData& metadata) // log metadata (see docs for details)
110+
{
111+
std::string message= "FMQ : "
112+
// + std::to_string(metadata.timestamp) + " "
113+
+ std::to_string(metadata.us.count()) + " "
114+
// + metadata.process_name + " "
115+
// + metadata.file + " "
116+
// + metadata.line + " "
117+
// + metadata.func + " "
118+
+ content;
119+
/* struct LogMetaData
120+
{
121+
std::time_t timestamp;
122+
std::chrono::microseconds us;
123+
std::string process_name;
124+
std::string file;
125+
std::string line;
126+
std::string func;
127+
std::string severity_name;
128+
fair::Severity severity;
129+
};
130+
*/
131+
theLog.logInfo(message);
132+
});
133+
102134
#else
103135
theLog.log("FAIRMQ : no");
104136
#endif

0 commit comments

Comments
 (0)