mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 17:41:45 +00:00
convert log severities use to lowercase and remove use of MQLOG
This commit is contained in:
committed by
Mohammad Al-Turany
parent
4e942e489b
commit
a3393e600e
@@ -50,27 +50,27 @@ Control::Control(const string name, const Plugin::Version version, const string
|
||||
|
||||
if (control == "static")
|
||||
{
|
||||
LOG(DEBUG) << "Running builtin controller: static";
|
||||
LOG(debug) << "Running builtin controller: static";
|
||||
fControllerThread = thread(&Control::StaticMode, this);
|
||||
}
|
||||
else if (control == "interactive")
|
||||
{
|
||||
LOG(DEBUG) << "Running builtin controller: interactive";
|
||||
LOG(debug) << "Running builtin controller: interactive";
|
||||
fControllerThread = thread(&Control::InteractiveMode, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(ERROR) << "Unrecognized control mode '" << control << "' requested. " << "Ignoring and falling back to static control mode.";
|
||||
LOG(error) << "Unrecognized control mode '" << control << "' requested. " << "Ignoring and falling back to static control mode.";
|
||||
fControllerThread = thread(&Control::StaticMode, this);
|
||||
}
|
||||
}
|
||||
catch (PluginServices::DeviceControlError& e)
|
||||
{
|
||||
// If we are here, it means another plugin has taken control. That's fine, just print the exception message and do nothing else.
|
||||
LOG(DEBUG) << e.what();
|
||||
LOG(debug) << e.what();
|
||||
}
|
||||
|
||||
LOG(DEBUG) << "catch-signals: " << GetProperty<int>("catch-signals");
|
||||
LOG(debug) << "catch-signals: " << GetProperty<int>("catch-signals");
|
||||
if (GetProperty<int>("catch-signals") > 0)
|
||||
{
|
||||
gSignalHandlerClosure = bind(&Control::SignalHandler, this, placeholders::_1);
|
||||
@@ -79,7 +79,7 @@ Control::Control(const string name, const Plugin::Version version, const string
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(WARN) << "Signal handling (e.g. Ctrl-C) has been deactivated.";
|
||||
LOG(warn) << "Signal handling (e.g. Ctrl-C) has been deactivated.";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,47 +127,47 @@ auto Control::InteractiveMode() -> void
|
||||
switch (input)
|
||||
{
|
||||
case 'i':
|
||||
LOG(INFO) << "\n\n --> [i] init device\n";
|
||||
LOG(info) << "\n\n --> [i] init device\n";
|
||||
ChangeDeviceState(DeviceStateTransition::InitDevice);
|
||||
break;
|
||||
case 'j':
|
||||
LOG(INFO) << "\n\n --> [j] init task\n";
|
||||
LOG(info) << "\n\n --> [j] init task\n";
|
||||
ChangeDeviceState(DeviceStateTransition::InitTask);
|
||||
break;
|
||||
case 'p':
|
||||
LOG(INFO) << "\n\n --> [p] pause\n";
|
||||
LOG(info) << "\n\n --> [p] pause\n";
|
||||
ChangeDeviceState(DeviceStateTransition::Pause);
|
||||
break;
|
||||
case 'r':
|
||||
LOG(INFO) << "\n\n --> [r] run\n";
|
||||
LOG(info) << "\n\n --> [r] run\n";
|
||||
ChangeDeviceState(DeviceStateTransition::Run);
|
||||
break;
|
||||
case 's':
|
||||
LOG(INFO) << "\n\n --> [s] stop\n";
|
||||
LOG(info) << "\n\n --> [s] stop\n";
|
||||
ChangeDeviceState(DeviceStateTransition::Stop);
|
||||
break;
|
||||
case 't':
|
||||
LOG(INFO) << "\n\n --> [t] reset task\n";
|
||||
LOG(info) << "\n\n --> [t] reset task\n";
|
||||
ChangeDeviceState(DeviceStateTransition::ResetTask);
|
||||
break;
|
||||
case 'd':
|
||||
LOG(INFO) << "\n\n --> [d] reset device\n";
|
||||
LOG(info) << "\n\n --> [d] reset device\n";
|
||||
ChangeDeviceState(DeviceStateTransition::ResetDevice);
|
||||
break;
|
||||
case 'h':
|
||||
LOG(INFO) << "\n\n --> [h] help\n";
|
||||
LOG(info) << "\n\n --> [h] help\n";
|
||||
PrintInteractiveHelp();
|
||||
break;
|
||||
// case 'x':
|
||||
// LOG(INFO) << "\n\n --> [x] ERROR\n";
|
||||
// LOG(info) << "\n\n --> [x] ERROR\n";
|
||||
// ChangeDeviceState(DeviceStateTransition::ERROR_FOUND);
|
||||
// break;
|
||||
case 'q':
|
||||
LOG(INFO) << "\n\n --> [q] end\n";
|
||||
LOG(info) << "\n\n --> [q] end\n";
|
||||
keepRunning = false;
|
||||
break;
|
||||
default:
|
||||
LOG(INFO) << "Invalid input: [" << input << "]";
|
||||
LOG(info) << "Invalid input: [" << input << "]";
|
||||
PrintInteractiveHelp();
|
||||
break;
|
||||
}
|
||||
@@ -191,13 +191,13 @@ auto Control::InteractiveMode() -> void
|
||||
catch (PluginServices::DeviceControlError& e)
|
||||
{
|
||||
// If we are here, it means another plugin has taken control. That's fine, just print the exception message and do nothing else.
|
||||
LOG(DEBUG) << e.what();
|
||||
LOG(debug) << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
auto Control::PrintInteractiveHelp() -> void
|
||||
{
|
||||
LOG(INFO) << "Use keys to control the state machine:\n\n"
|
||||
LOG(info) << "Use keys to control the state machine:\n\n"
|
||||
<< "[h] help, [p] pause, [r] run, [s] stop, [t] reset task, [d] reset device, [q] end, [j] init task, [i] init device\n";
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ auto Control::StaticMode() -> void
|
||||
catch (PluginServices::DeviceControlError& e)
|
||||
{
|
||||
// If we are here, it means another plugin has taken control. That's fine, just print the exception message and do nothing else.
|
||||
LOG(DEBUG) << e.what();
|
||||
LOG(debug) << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,8 +250,8 @@ auto Control::SignalHandler(int signal) -> void
|
||||
|
||||
StealDeviceControl();
|
||||
|
||||
LOG(INFO) << "Received device shutdown request (signal " << signal << ").";
|
||||
LOG(INFO) << "Waiting for graceful device shutdown. Hit Ctrl-C again to abort immediately.";
|
||||
LOG(info) << "Received device shutdown request (signal " << signal << ").";
|
||||
LOG(info) << "Waiting for graceful device shutdown. Hit Ctrl-C again to abort immediately.";
|
||||
|
||||
UnsubscribeFromDeviceStateChange(); // In case, static or interactive mode have subscribed already
|
||||
SubscribeToDeviceStateChange([&](DeviceState newState)
|
||||
@@ -267,8 +267,8 @@ auto Control::SignalHandler(int signal) -> void
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(WARN) << "Received 2nd device shutdown request (signal " << signal << ").";
|
||||
LOG(WARN) << "Aborting immediately !";
|
||||
LOG(warn) << "Received 2nd device shutdown request (signal " << signal << ").";
|
||||
LOG(warn) << "Aborting immediately !";
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
@@ -53,11 +53,11 @@ DDS::DDS(const string name, const Plugin::Version version, const string maintain
|
||||
}
|
||||
catch (PluginServices::DeviceControlError& e)
|
||||
{
|
||||
LOG(DEBUG) << e.what();
|
||||
LOG(debug) << e.what();
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
LOG(ERROR) << "Error in plugin initialization: " << e.what();
|
||||
LOG(error) << "Error in plugin initialization: " << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,10 +70,10 @@ auto DDS::HandleControl() -> void
|
||||
|
||||
// subscribe for DDS service errors.
|
||||
fService.subscribeOnError([](const dds::intercom_api::EErrorCode errorCode, const string& errorMsg) {
|
||||
LOG(ERROR) << "DDS Error received: error code: " << errorCode << ", error message: " << errorMsg << endl;
|
||||
LOG(error) << "DDS Error received: error code: " << errorCode << ", error message: " << errorMsg << endl;
|
||||
});
|
||||
|
||||
LOG(DEBUG) << "Subscribing for DDS properties.";
|
||||
LOG(debug) << "Subscribing for DDS properties.";
|
||||
SubscribeForConnectingChannels();
|
||||
|
||||
// subscribe to device state changes, pushing new state chenges into the event queue
|
||||
@@ -94,7 +94,7 @@ auto DDS::HandleControl() -> void
|
||||
string id = GetProperty<string>("id");
|
||||
for (auto subscriberId : fStateChangeSubscribers)
|
||||
{
|
||||
LOG(DEBUG) << "Publishing state-change: " << newState << " to " << subscriberId;
|
||||
LOG(debug) << "Publishing state-change: " << newState << " to " << subscriberId;
|
||||
fDDSCustomCmd.send("state-change: " + id + "," + ToStr(newState), to_string(subscriberId));
|
||||
}
|
||||
}
|
||||
@@ -125,11 +125,11 @@ auto DDS::HandleControl() -> void
|
||||
{
|
||||
fStopCondition.wait_for(lock, chrono::seconds(1));
|
||||
}
|
||||
LOG(DEBUG) << "Stopping DDS control plugin";
|
||||
LOG(debug) << "Stopping DDS control plugin";
|
||||
}
|
||||
catch (exception& e)
|
||||
{
|
||||
LOG(ERROR) << "Error: " << e.what() << endl;
|
||||
LOG(error) << "Error: " << e.what() << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ auto DDS::FillChannelContainers() -> void
|
||||
else if (GetProperty<string>(methodKey) == "connect")
|
||||
{
|
||||
fConnectingChans.insert(make_pair(c.first, DDSConfig()));
|
||||
LOG(DEBUG) << "preparing to connect: " << c.first << " with " << c.second << " sub-channels.";
|
||||
LOG(debug) << "preparing to connect: " << c.first << " with " << c.second << " sub-channels.";
|
||||
for (int i = 0; i < c.second; ++i)
|
||||
{
|
||||
fConnectingChans.at(c.first).fSubChannelAddresses.push_back(string());
|
||||
@@ -166,7 +166,7 @@ auto DDS::FillChannelContainers() -> void
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(ERROR) << "Cannot update address configuration. Channel method (bind/connect) not specified.";
|
||||
LOG(error) << "Cannot update address configuration. Channel method (bind/connect) not specified.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@ auto DDS::SubscribeForConnectingChannels() -> void
|
||||
fDDSKeyValue.subscribe([&] (const string& propertyId, const string& key, const string& value)
|
||||
{
|
||||
try {
|
||||
LOG(DEBUG) << "Received update for " << propertyId << ": key=" << key << " value=" << value;
|
||||
LOG(debug) << "Received update for " << propertyId << ": key=" << key << " value=" << value;
|
||||
fConnectingChans.at(propertyId).fDDSValues.insert(make_pair<string, string>(key.c_str(), value.c_str()));
|
||||
|
||||
// update channels and remove them from unfinished container
|
||||
@@ -203,7 +203,7 @@ auto DDS::SubscribeForConnectingChannels() -> void
|
||||
}
|
||||
} catch (const exception& e)
|
||||
{
|
||||
LOG(ERROR) << "Error on handling DDS property update for " << propertyId << ": key=" << key << " value=" << value << ": " << e.what();
|
||||
LOG(error) << "Error on handling DDS property update for " << propertyId << ": key=" << key << " value=" << value << ": " << e.what();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -215,7 +215,7 @@ auto DDS::PublishBoundChannels() -> void
|
||||
unsigned int index = 0;
|
||||
for (const auto& i : chan.second)
|
||||
{
|
||||
LOG(DEBUG) << "Publishing " << chan.first << "[" << index << "] address to DDS under '" << chan.first << "' property name.";
|
||||
LOG(debug) << "Publishing " << chan.first << "[" << index << "] address to DDS under '" << chan.first << "' property name.";
|
||||
fDDSKeyValue.putValue(chan.first, i);
|
||||
++index;
|
||||
}
|
||||
@@ -245,7 +245,7 @@ auto DDS::SubscribeForCustomCommands() -> void
|
||||
|
||||
fDDSCustomCmd.subscribe([id, pid, this](const string& cmd, const string& cond, uint64_t senderId)
|
||||
{
|
||||
LOG(INFO) << "Received command: " << cmd;
|
||||
LOG(info) << "Received command: " << cmd;
|
||||
|
||||
if (cmd == "check-state")
|
||||
{
|
||||
@@ -302,7 +302,7 @@ auto DDS::SubscribeForCustomCommands() -> void
|
||||
}
|
||||
fDDSCustomCmd.send("state-changes-subscription: " + id + ",OK", to_string(senderId));
|
||||
auto state = GetCurrentDeviceState();
|
||||
LOG(DEBUG) << "Publishing state-change: " << state << " to " << senderId;
|
||||
LOG(debug) << "Publishing state-change: " << state << " to " << senderId;
|
||||
fDDSCustomCmd.send("state-change: " + id + "," + ToStr(state), to_string(senderId));
|
||||
}
|
||||
else if (cmd == "unsubscribe-from-state-changes")
|
||||
@@ -315,9 +315,9 @@ auto DDS::SubscribeForCustomCommands() -> void
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(WARN) << "Unknown command: " << cmd;
|
||||
LOG(WARN) << "Origin: " << senderId;
|
||||
LOG(WARN) << "Destination: " << cond;
|
||||
LOG(warn) << "Unknown command: " << cmd;
|
||||
LOG(warn) << "Origin: " << senderId;
|
||||
LOG(warn) << "Destination: " << cond;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user