mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-16 10:01:47 +00:00
Refactor FairMQLogger
This commit is contained in:
committed by
Mohammad Al-Turany
parent
6ecd0e9085
commit
6d7009b331
@@ -79,7 +79,7 @@ void FairMQProgOptions::ParseAll(const int argc, char const* const* argv, bool a
|
||||
// if these options are provided, do no further checks and let the device handle them
|
||||
if (fVarMap.count("print-channels") || fVarMap.count("version"))
|
||||
{
|
||||
DefaultConsoleSetFilter(fSeverityMap.at("NOLOG"));
|
||||
fair::mq::logger::DefaultConsoleSetFilter(fSeverityMap.at("NOLOG"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -96,17 +96,17 @@ void FairMQProgOptions::ParseAll(const int argc, char const* const* argv, bool a
|
||||
|
||||
if (logFile != "")
|
||||
{
|
||||
reinit_logger(false, logFile, fSeverityMap.at(verbosity));
|
||||
DefaultConsoleSetFilter(fSeverityMap.at("NOLOG"));
|
||||
fair::mq::logger::ReinitLogger(false, logFile, fSeverityMap.at(verbosity));
|
||||
fair::mq::logger::DefaultConsoleSetFilter(fSeverityMap.at("NOLOG"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!color)
|
||||
{
|
||||
reinit_logger(false);
|
||||
fair::mq::logger::ReinitLogger(false);
|
||||
}
|
||||
|
||||
DefaultConsoleSetFilter(fSeverityMap.at(verbosity));
|
||||
fair::mq::logger::DefaultConsoleSetFilter(fSeverityMap.at(verbosity));
|
||||
}
|
||||
|
||||
// check if one of required MQ config option is there
|
||||
|
@@ -8,16 +8,16 @@
|
||||
/*
|
||||
* File: FairProgOptions.cxx
|
||||
* Author: winckler
|
||||
*
|
||||
*
|
||||
* Created on March 11, 2015, 5:38 PM
|
||||
*/
|
||||
|
||||
#include "FairProgOptions.h"
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/// //////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Constructor
|
||||
FairProgOptions::FairProgOptions() :
|
||||
fVarMap(),
|
||||
fGenericDesc("Generic options description"),
|
||||
@@ -42,14 +42,14 @@ FairProgOptions::FairProgOptions() :
|
||||
("log-color", po::value<bool>()->default_value(true), "logger color: true or false")
|
||||
("print-options", po::value<bool>()->implicit_value(true), "print options in machine-readable format (<option>:<computed-value>:<type>:<description>)");
|
||||
|
||||
fSeverityMap["TRACE"] = FairMQ::severity_level::TRACE;
|
||||
fSeverityMap["DEBUG"] = FairMQ::severity_level::DEBUG;
|
||||
fSeverityMap["RESULTS"] = FairMQ::severity_level::RESULTS;
|
||||
fSeverityMap["INFO"] = FairMQ::severity_level::INFO;
|
||||
fSeverityMap["WARN"] = FairMQ::severity_level::WARN;
|
||||
fSeverityMap["ERROR"] = FairMQ::severity_level::ERROR;
|
||||
fSeverityMap["STATE"] = FairMQ::severity_level::STATE;
|
||||
fSeverityMap["NOLOG"] = FairMQ::severity_level::NOLOG;
|
||||
fSeverityMap["TRACE"] = fair::mq::logger::SeverityLevel::TRACE;
|
||||
fSeverityMap["DEBUG"] = fair::mq::logger::SeverityLevel::DEBUG;
|
||||
fSeverityMap["RESULTS"] = fair::mq::logger::SeverityLevel::RESULTS;
|
||||
fSeverityMap["INFO"] = fair::mq::logger::SeverityLevel::INFO;
|
||||
fSeverityMap["WARN"] = fair::mq::logger::SeverityLevel::WARN;
|
||||
fSeverityMap["ERROR"] = fair::mq::logger::SeverityLevel::ERROR;
|
||||
fSeverityMap["STATE"] = fair::mq::logger::SeverityLevel::STATE;
|
||||
fSeverityMap["NOLOG"] = fair::mq::logger::SeverityLevel::NOLOG;
|
||||
}
|
||||
|
||||
/// Destructor
|
||||
|
@@ -135,14 +135,14 @@ class FairProgOptions
|
||||
template<typename T>
|
||||
T ConvertTo(const std::string& strValue)
|
||||
{
|
||||
if (std::is_arithmetic<T>::value)
|
||||
if (std::is_arithmetic<T>::value)
|
||||
{
|
||||
std::istringstream iss(strValue);
|
||||
T val;
|
||||
iss >> val;
|
||||
return val;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(ERROR) << "the provided string " << strValue << " cannot be converted in the requested type. The target types must be arithmetic types";
|
||||
}
|
||||
@@ -183,7 +183,7 @@ class FairProgOptions
|
||||
|
||||
// Description which is printed in help command line
|
||||
// to handle logger severity
|
||||
std::map<std::string, FairMQ::severity_level> fSeverityMap;
|
||||
std::map<std::string, fair::mq::logger::SeverityLevel> fSeverityMap;
|
||||
po::options_description fVisibleOptions;
|
||||
|
||||
mutable std::mutex fConfigMutex;
|
||||
|
Reference in New Issue
Block a user