Skip to content

Commit

Permalink
fairmq logger
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-c committed Feb 12, 2018
1 parent 1114392 commit 8177b64
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/mainReadout.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
#endif


#ifdef WITH_FAIRMQ
#include <fairmq/FairMQLogger.h>
#endif


using namespace AliceO2::InfoLogger;
using namespace AliceO2::Common;
Expand Down Expand Up @@ -99,6 +103,34 @@ int main(int argc, char* argv[])
theLog.log("Optional built features enabled:");
#ifdef WITH_FAIRMQ
theLog.log("FAIRMQ : yes");
fair::Logger::SetConsoleColor(true);
fair::Logger::SetConsoleSeverity("nolog");
fair::Logger::AddCustomSink("infoLogger", "trace", [&](const std::string& content, // log content
const fair::LogMetaData& metadata) // log metadata (see docs for details)
{
std::string message= "FMQ : "
// + std::to_string(metadata.timestamp) + " "
+ std::to_string(metadata.us.count()) + " "
// + metadata.process_name + " "
// + metadata.file + " "
// + metadata.line + " "
// + metadata.func + " "
+ content;
/* struct LogMetaData
{
std::time_t timestamp;
std::chrono::microseconds us;
std::string process_name;
std::string file;
std::string line;
std::string func;
std::string severity_name;
fair::Severity severity;
};
*/
theLog.logInfo(message);
});

#else
theLog.log("FAIRMQ : no");
#endif
Expand Down

0 comments on commit 8177b64

Please sign in to comment.