From 49d8a1b4dda2c2d446b73a1e39303b581f06f048 Mon Sep 17 00:00:00 2001 From: Alexey Rybalchenko Date: Thu, 15 Oct 2020 11:15:28 +0200 Subject: [PATCH] DeviceRunner: Set log severity only if one was provided --- fairmq/DeviceRunner.cxx | 4 +++- fairmq/ProgOptions.cxx | 2 +- test/helper/devices/TestErrorState.h | 18 +++++++++--------- test/helper/devices/TestSignals.h | 18 +++++++++--------- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/fairmq/DeviceRunner.cxx b/fairmq/DeviceRunner.cxx index 14682076..afbf0eca 100644 --- a/fairmq/DeviceRunner.cxx +++ b/fairmq/DeviceRunner.cxx @@ -56,7 +56,9 @@ bool DeviceRunner::HandleGeneralOptions(const fair::mq::ProgOptions& config, boo fair::Logger::SetConsoleSeverity("nolog"); } else { fair::Logger::SetConsoleColor(color); - fair::Logger::SetConsoleSeverity(severity); + if (severity != "") { + fair::Logger::SetConsoleSeverity(severity); + } } if (printLogo) { diff --git a/fairmq/ProgOptions.cxx b/fairmq/ProgOptions.cxx index 5f799705..6565fea5 100644 --- a/fairmq/ProgOptions.cxx +++ b/fairmq/ProgOptions.cxx @@ -79,7 +79,7 @@ ProgOptions::ProgOptions() fAllOptions.add_options() ("help,h", "Print help") ("version,v", "Print version") - ("severity", po::value()->default_value("debug"), "Log severity level (console): trace, debug, info, state, warn, error, fatal, nolog") + ("severity", po::value()->default_value(""), "Log severity level (console): trace, debug, info, state, warn, error, fatal, nolog.") ("file-severity", po::value()->default_value("debug"), "Log severity level (file): trace, debug, info, state, warn, error, fatal, nolog") ("verbosity", po::value()->default_value("medium"), "Log verbosity level: veryhigh, high, medium, low") ("color", po::value()->default_value(true), "Log color (true/false)") diff --git a/test/helper/devices/TestErrorState.h b/test/helper/devices/TestErrorState.h index 42b89dea..e7e7af78 100644 --- a/test/helper/devices/TestErrorState.h +++ b/test/helper/devices/TestErrorState.h @@ -28,7 +28,7 @@ class ErrorState : public FairMQDevice { std::string state("Init"); 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); } } @@ -37,7 +37,7 @@ class ErrorState : public FairMQDevice { std::string state("Bind"); 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); } } @@ -46,7 +46,7 @@ class ErrorState : public FairMQDevice { std::string state("Connect"); 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); } } @@ -55,7 +55,7 @@ class ErrorState : public FairMQDevice { std::string state("InitTask"); 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); } } @@ -64,7 +64,7 @@ class ErrorState : public FairMQDevice { std::string state("PreRun"); 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); } } @@ -73,7 +73,7 @@ class ErrorState : public FairMQDevice { std::string state("Run"); 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); } } @@ -82,7 +82,7 @@ class ErrorState : public FairMQDevice { std::string state("PostRun"); 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); } } @@ -91,7 +91,7 @@ class ErrorState : public FairMQDevice { std::string state("ResetTask"); 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); } } @@ -100,7 +100,7 @@ class ErrorState : public FairMQDevice { std::string state("Reset"); 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); } } diff --git a/test/helper/devices/TestSignals.h b/test/helper/devices/TestSignals.h index f85a1a97..474cb764 100644 --- a/test/helper/devices/TestSignals.h +++ b/test/helper/devices/TestSignals.h @@ -29,7 +29,7 @@ class Signals : public FairMQDevice { std::string state("Init"); if (std::string::npos != GetId().find("_" + state + "_")) { - LOG(debug) << "raising SIGINT from " << state << "()"; + LOG(info) << "raising SIGINT from " << state << "()"; raise(SIGINT); } } @@ -37,7 +37,7 @@ class Signals : public FairMQDevice { std::string state("Bind"); if (std::string::npos != GetId().find("_" + state + "_")) { - LOG(debug) << "raising SIGINT from " << state << "()"; + LOG(info) << "raising SIGINT from " << state << "()"; raise(SIGINT); } } @@ -45,7 +45,7 @@ class Signals : public FairMQDevice { std::string state("Connect"); if (std::string::npos != GetId().find("_" + state + "_")) { - LOG(debug) << "raising SIGINT from " << state << "()"; + LOG(info) << "raising SIGINT from " << state << "()"; raise(SIGINT); } } @@ -54,7 +54,7 @@ class Signals : public FairMQDevice { std::string state("InitTask"); if (std::string::npos != GetId().find("_" + state + "_")) { - LOG(debug) << "raising SIGINT from " << state << "()"; + LOG(info) << "raising SIGINT from " << state << "()"; raise(SIGINT); } } @@ -63,7 +63,7 @@ class Signals : public FairMQDevice { std::string state("PreRun"); if (std::string::npos != GetId().find("_" + state + "_")) { - LOG(debug) << "raising SIGINT from " << state << "()"; + LOG(info) << "raising SIGINT from " << state << "()"; raise(SIGINT); } } @@ -72,7 +72,7 @@ class Signals : public FairMQDevice { std::string state("Run"); if (std::string::npos != GetId().find("_" + state + "_")) { - LOG(debug) << "raising SIGINT from " << state << "()"; + LOG(info) << "raising SIGINT from " << state << "()"; raise(SIGINT); } } @@ -81,7 +81,7 @@ class Signals : public FairMQDevice { std::string state("PostRun"); if (std::string::npos != GetId().find("_" + state + "_")) { - LOG(debug) << "raising SIGINT from " << state << "()"; + LOG(info) << "raising SIGINT from " << state << "()"; raise(SIGINT); } } @@ -90,7 +90,7 @@ class Signals : public FairMQDevice { std::string state("ResetTask"); if (std::string::npos != GetId().find("_" + state + "_")) { - LOG(debug) << "raising SIGINT from " << state << "()"; + LOG(info) << "raising SIGINT from " << state << "()"; raise(SIGINT); } } @@ -99,7 +99,7 @@ class Signals : public FairMQDevice { std::string state("Reset"); if (std::string::npos != GetId().find("_" + state + "_")) { - LOG(debug) << "raising SIGINT from " << state << "()"; + LOG(info) << "raising SIGINT from " << state << "()"; raise(SIGINT); } }