DeviceRunner: Set log severity only if one was provided

This commit is contained in:
Alexey Rybalchenko 2020-10-15 11:15:28 +02:00
parent f14f507584
commit 49d8a1b4dd
4 changed files with 22 additions and 20 deletions

View File

@ -56,7 +56,9 @@ bool DeviceRunner::HandleGeneralOptions(const fair::mq::ProgOptions& config, boo
fair::Logger::SetConsoleSeverity("nolog"); fair::Logger::SetConsoleSeverity("nolog");
} else { } else {
fair::Logger::SetConsoleColor(color); fair::Logger::SetConsoleColor(color);
fair::Logger::SetConsoleSeverity(severity); if (severity != "") {
fair::Logger::SetConsoleSeverity(severity);
}
} }
if (printLogo) { if (printLogo) {

View File

@ -79,7 +79,7 @@ ProgOptions::ProgOptions()
fAllOptions.add_options() fAllOptions.add_options()
("help,h", "Print help") ("help,h", "Print help")
("version,v", "Print version") ("version,v", "Print version")
("severity", po::value<string>()->default_value("debug"), "Log severity level (console): trace, debug, info, state, warn, error, fatal, nolog") ("severity", po::value<string>()->default_value(""), "Log severity level (console): trace, debug, info, state, warn, error, fatal, nolog.")
("file-severity", po::value<string>()->default_value("debug"), "Log severity level (file): trace, debug, info, state, warn, error, fatal, nolog") ("file-severity", po::value<string>()->default_value("debug"), "Log severity level (file): trace, debug, info, state, warn, error, fatal, nolog")
("verbosity", po::value<string>()->default_value("medium"), "Log verbosity level: veryhigh, high, medium, low") ("verbosity", po::value<string>()->default_value("medium"), "Log verbosity level: veryhigh, high, medium, low")
("color", po::value<bool >()->default_value(true), "Log color (true/false)") ("color", po::value<bool >()->default_value(true), "Log color (true/false)")

View File

@ -28,7 +28,7 @@ class ErrorState : public FairMQDevice
{ {
std::string state("Init"); std::string state("Init");
if (std::string::npos != GetId().find("_" + state + "_")) { if (std::string::npos != GetId().find("_" + state + "_")) {
LOG(debug) << "going to change to Error state from " << state << "()"; LOG(info) << "going to change to Error state from " << state << "()";
ChangeState(fair::mq::Transition::ErrorFound); ChangeState(fair::mq::Transition::ErrorFound);
} }
} }
@ -37,7 +37,7 @@ class ErrorState : public FairMQDevice
{ {
std::string state("Bind"); std::string state("Bind");
if (std::string::npos != GetId().find("_" + state + "_")) { if (std::string::npos != GetId().find("_" + state + "_")) {
LOG(debug) << "going to change to Error state from " << state << "()"; LOG(info) << "going to change to Error state from " << state << "()";
ChangeState(fair::mq::Transition::ErrorFound); ChangeState(fair::mq::Transition::ErrorFound);
} }
} }
@ -46,7 +46,7 @@ class ErrorState : public FairMQDevice
{ {
std::string state("Connect"); std::string state("Connect");
if (std::string::npos != GetId().find("_" + state + "_")) { if (std::string::npos != GetId().find("_" + state + "_")) {
LOG(debug) << "going to change to Error state from " << state << "()"; LOG(info) << "going to change to Error state from " << state << "()";
ChangeState(fair::mq::Transition::ErrorFound); ChangeState(fair::mq::Transition::ErrorFound);
} }
} }
@ -55,7 +55,7 @@ class ErrorState : public FairMQDevice
{ {
std::string state("InitTask"); std::string state("InitTask");
if (std::string::npos != GetId().find("_" + state + "_")) { if (std::string::npos != GetId().find("_" + state + "_")) {
LOG(debug) << "going to change to Error state from " << state << "()"; LOG(info) << "going to change to Error state from " << state << "()";
ChangeState(fair::mq::Transition::ErrorFound); ChangeState(fair::mq::Transition::ErrorFound);
} }
} }
@ -64,7 +64,7 @@ class ErrorState : public FairMQDevice
{ {
std::string state("PreRun"); std::string state("PreRun");
if (std::string::npos != GetId().find("_" + state + "_")) { if (std::string::npos != GetId().find("_" + state + "_")) {
LOG(debug) << "going to change to Error state from " << state << "()"; LOG(info) << "going to change to Error state from " << state << "()";
ChangeState(fair::mq::Transition::ErrorFound); ChangeState(fair::mq::Transition::ErrorFound);
} }
} }
@ -73,7 +73,7 @@ class ErrorState : public FairMQDevice
{ {
std::string state("Run"); std::string state("Run");
if (std::string::npos != GetId().find("_" + state + "_")) { if (std::string::npos != GetId().find("_" + state + "_")) {
LOG(debug) << "going to change to Error state from " << state << "()"; LOG(info) << "going to change to Error state from " << state << "()";
ChangeState(fair::mq::Transition::ErrorFound); ChangeState(fair::mq::Transition::ErrorFound);
} }
} }
@ -82,7 +82,7 @@ class ErrorState : public FairMQDevice
{ {
std::string state("PostRun"); std::string state("PostRun");
if (std::string::npos != GetId().find("_" + state + "_")) { if (std::string::npos != GetId().find("_" + state + "_")) {
LOG(debug) << "going to change to Error state from " << state << "()"; LOG(info) << "going to change to Error state from " << state << "()";
ChangeState(fair::mq::Transition::ErrorFound); ChangeState(fair::mq::Transition::ErrorFound);
} }
} }
@ -91,7 +91,7 @@ class ErrorState : public FairMQDevice
{ {
std::string state("ResetTask"); std::string state("ResetTask");
if (std::string::npos != GetId().find("_" + state + "_")) { if (std::string::npos != GetId().find("_" + state + "_")) {
LOG(debug) << "going to change to Error state from " << state << "()"; LOG(info) << "going to change to Error state from " << state << "()";
ChangeState(fair::mq::Transition::ErrorFound); ChangeState(fair::mq::Transition::ErrorFound);
} }
} }
@ -100,7 +100,7 @@ class ErrorState : public FairMQDevice
{ {
std::string state("Reset"); std::string state("Reset");
if (std::string::npos != GetId().find("_" + state + "_")) { if (std::string::npos != GetId().find("_" + state + "_")) {
LOG(debug) << "going to change to Error state from " << state << "()"; LOG(info) << "going to change to Error state from " << state << "()";
ChangeState(fair::mq::Transition::ErrorFound); ChangeState(fair::mq::Transition::ErrorFound);
} }
} }

View File

@ -29,7 +29,7 @@ class Signals : public FairMQDevice
{ {
std::string state("Init"); std::string state("Init");
if (std::string::npos != GetId().find("_" + state + "_")) { if (std::string::npos != GetId().find("_" + state + "_")) {
LOG(debug) << "raising SIGINT from " << state << "()"; LOG(info) << "raising SIGINT from " << state << "()";
raise(SIGINT); raise(SIGINT);
} }
} }
@ -37,7 +37,7 @@ class Signals : public FairMQDevice
{ {
std::string state("Bind"); std::string state("Bind");
if (std::string::npos != GetId().find("_" + state + "_")) { if (std::string::npos != GetId().find("_" + state + "_")) {
LOG(debug) << "raising SIGINT from " << state << "()"; LOG(info) << "raising SIGINT from " << state << "()";
raise(SIGINT); raise(SIGINT);
} }
} }
@ -45,7 +45,7 @@ class Signals : public FairMQDevice
{ {
std::string state("Connect"); std::string state("Connect");
if (std::string::npos != GetId().find("_" + state + "_")) { if (std::string::npos != GetId().find("_" + state + "_")) {
LOG(debug) << "raising SIGINT from " << state << "()"; LOG(info) << "raising SIGINT from " << state << "()";
raise(SIGINT); raise(SIGINT);
} }
} }
@ -54,7 +54,7 @@ class Signals : public FairMQDevice
{ {
std::string state("InitTask"); std::string state("InitTask");
if (std::string::npos != GetId().find("_" + state + "_")) { if (std::string::npos != GetId().find("_" + state + "_")) {
LOG(debug) << "raising SIGINT from " << state << "()"; LOG(info) << "raising SIGINT from " << state << "()";
raise(SIGINT); raise(SIGINT);
} }
} }
@ -63,7 +63,7 @@ class Signals : public FairMQDevice
{ {
std::string state("PreRun"); std::string state("PreRun");
if (std::string::npos != GetId().find("_" + state + "_")) { if (std::string::npos != GetId().find("_" + state + "_")) {
LOG(debug) << "raising SIGINT from " << state << "()"; LOG(info) << "raising SIGINT from " << state << "()";
raise(SIGINT); raise(SIGINT);
} }
} }
@ -72,7 +72,7 @@ class Signals : public FairMQDevice
{ {
std::string state("Run"); std::string state("Run");
if (std::string::npos != GetId().find("_" + state + "_")) { if (std::string::npos != GetId().find("_" + state + "_")) {
LOG(debug) << "raising SIGINT from " << state << "()"; LOG(info) << "raising SIGINT from " << state << "()";
raise(SIGINT); raise(SIGINT);
} }
} }
@ -81,7 +81,7 @@ class Signals : public FairMQDevice
{ {
std::string state("PostRun"); std::string state("PostRun");
if (std::string::npos != GetId().find("_" + state + "_")) { if (std::string::npos != GetId().find("_" + state + "_")) {
LOG(debug) << "raising SIGINT from " << state << "()"; LOG(info) << "raising SIGINT from " << state << "()";
raise(SIGINT); raise(SIGINT);
} }
} }
@ -90,7 +90,7 @@ class Signals : public FairMQDevice
{ {
std::string state("ResetTask"); std::string state("ResetTask");
if (std::string::npos != GetId().find("_" + state + "_")) { if (std::string::npos != GetId().find("_" + state + "_")) {
LOG(debug) << "raising SIGINT from " << state << "()"; LOG(info) << "raising SIGINT from " << state << "()";
raise(SIGINT); raise(SIGINT);
} }
} }
@ -99,7 +99,7 @@ class Signals : public FairMQDevice
{ {
std::string state("Reset"); std::string state("Reset");
if (std::string::npos != GetId().find("_" + state + "_")) { if (std::string::npos != GetId().find("_" + state + "_")) {
LOG(debug) << "raising SIGINT from " << state << "()"; LOG(info) << "raising SIGINT from " << state << "()";
raise(SIGINT); raise(SIGINT);
} }
} }