diff --git a/fairmq/DeviceRunner.cxx b/fairmq/DeviceRunner.cxx index 380c2ad1..93f446b5 100644 --- a/fairmq/DeviceRunner.cxx +++ b/fairmq/DeviceRunner.cxx @@ -52,7 +52,7 @@ auto DeviceRunner::Run() -> int if (!fDevice) { - LOG(ERROR) << "getDevice(): no valid device provided. Exiting."; + LOG(error) << "getDevice(): no valid device provided. Exiting."; return 1; } @@ -74,7 +74,7 @@ auto DeviceRunner::Run() -> int return 0; } - LOG(DEBUG) << "PID: " << getpid(); + LOG(debug) << "PID: " << getpid(); // Configure device fDevice->SetConfig(fConfig); @@ -99,12 +99,12 @@ auto DeviceRunner::RunWithExceptionHandlers() -> int } catch (std::exception& e) { - LOG(ERROR) << "Unhandled exception reached the top of main: " << e.what() << ", application will now exit"; + LOG(error) << "Unhandled exception reached the top of main: " << e.what() << ", application will now exit"; return 1; } catch (...) { - LOG(ERROR) << "Non-exception instance being thrown. Please make sure you use std::runtime_exception() instead. Application will now exit."; + LOG(error) << "Non-exception instance being thrown. Please make sure you use std::runtime_exception() instead. Application will now exit."; return 1; } } diff --git a/fairmq/FairMQChannel.cxx b/fairmq/FairMQChannel.cxx index 7e67d7ef..ddd07cd0 100644 --- a/fairmq/FairMQChannel.cxx +++ b/fairmq/FairMQChannel.cxx @@ -183,7 +183,7 @@ string FairMQChannel::GetType() const } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::GetType: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::GetType: " << e.what(); exit(EXIT_FAILURE); } } @@ -197,7 +197,7 @@ string FairMQChannel::GetMethod() const } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::GetMethod: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::GetMethod: " << e.what(); exit(EXIT_FAILURE); } } @@ -211,7 +211,7 @@ string FairMQChannel::GetAddress() const } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::GetAddress: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::GetAddress: " << e.what(); exit(EXIT_FAILURE); } } @@ -225,7 +225,7 @@ string FairMQChannel::GetTransport() const } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::GetTransport: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::GetTransport: " << e.what(); exit(EXIT_FAILURE); } } @@ -239,7 +239,7 @@ int FairMQChannel::GetSndBufSize() const } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::GetSndBufSize: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::GetSndBufSize: " << e.what(); exit(EXIT_FAILURE); } } @@ -253,7 +253,7 @@ int FairMQChannel::GetRcvBufSize() const } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::GetRcvBufSize: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::GetRcvBufSize: " << e.what(); exit(EXIT_FAILURE); } } @@ -267,7 +267,7 @@ int FairMQChannel::GetSndKernelSize() const } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::GetSndKernelSize: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::GetSndKernelSize: " << e.what(); exit(EXIT_FAILURE); } } @@ -281,7 +281,7 @@ int FairMQChannel::GetRcvKernelSize() const } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::GetRcvKernelSize: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::GetRcvKernelSize: " << e.what(); exit(EXIT_FAILURE); } } @@ -295,7 +295,7 @@ int FairMQChannel::GetRateLogging() const } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::GetRateLogging: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::GetRateLogging: " << e.what(); exit(EXIT_FAILURE); } } @@ -311,7 +311,7 @@ void FairMQChannel::UpdateType(const string& type) } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::UpdateType: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::UpdateType: " << e.what(); exit(EXIT_FAILURE); } } @@ -327,7 +327,7 @@ void FairMQChannel::UpdateMethod(const string& method) } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::UpdateMethod: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::UpdateMethod: " << e.what(); exit(EXIT_FAILURE); } } @@ -343,7 +343,7 @@ void FairMQChannel::UpdateAddress(const string& address) } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::UpdateAddress: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::UpdateAddress: " << e.what(); exit(EXIT_FAILURE); } } @@ -359,7 +359,7 @@ void FairMQChannel::UpdateTransport(const string& transport) } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::UpdateTransport: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::UpdateTransport: " << e.what(); exit(EXIT_FAILURE); } } @@ -375,7 +375,7 @@ void FairMQChannel::UpdateSndBufSize(const int sndBufSize) } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::UpdateSndBufSize: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::UpdateSndBufSize: " << e.what(); exit(EXIT_FAILURE); } } @@ -391,7 +391,7 @@ void FairMQChannel::UpdateRcvBufSize(const int rcvBufSize) } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::UpdateRcvBufSize: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::UpdateRcvBufSize: " << e.what(); exit(EXIT_FAILURE); } } @@ -407,7 +407,7 @@ void FairMQChannel::UpdateSndKernelSize(const int sndKernelSize) } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::UpdateSndKernelSize: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::UpdateSndKernelSize: " << e.what(); exit(EXIT_FAILURE); } } @@ -423,7 +423,7 @@ void FairMQChannel::UpdateRcvKernelSize(const int rcvKernelSize) } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::UpdateRcvKernelSize: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::UpdateRcvKernelSize: " << e.what(); exit(EXIT_FAILURE); } } @@ -439,7 +439,7 @@ void FairMQChannel::UpdateRateLogging(const int rateLogging) } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::UpdateRateLogging: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::UpdateRateLogging: " << e.what(); exit(EXIT_FAILURE); } } @@ -453,7 +453,7 @@ auto FairMQChannel::SetModified(const bool modified) -> void } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::SetModified: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::SetModified: " << e.what(); exit(EXIT_FAILURE); } } @@ -469,7 +469,7 @@ void FairMQChannel::UpdateChannelName(const string& name) } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::UpdateChannelName: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::UpdateChannelName: " << e.what(); exit(EXIT_FAILURE); } } @@ -483,7 +483,7 @@ bool FairMQChannel::IsValid() const } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::IsValid: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::IsValid: " << e.what(); exit(EXIT_FAILURE); } } @@ -500,7 +500,7 @@ bool FairMQChannel::ValidateChannel() if (fIsValid) { ss << "ALREADY VALID"; - LOG(DEBUG) << ss.str(); + LOG(debug) << ss.str(); return true; } @@ -510,8 +510,8 @@ bool FairMQChannel::ValidateChannel() if (socketTypes.find(fType) == socketTypes.end()) { ss << "INVALID"; - LOG(DEBUG) << ss.str(); - LOG(ERROR) << "Invalid channel type: \"" << fType << "\""; + LOG(debug) << ss.str(); + LOG(error) << "Invalid channel type: \"" << fType << "\""; exit(EXIT_FAILURE); } @@ -519,8 +519,8 @@ bool FairMQChannel::ValidateChannel() if (fAddress == "unspecified" || fAddress == "") { ss << "INVALID"; - LOG(DEBUG) << ss.str(); - LOG(DEBUG) << "invalid channel address: \"" << fAddress << "\""; + LOG(debug) << ss.str(); + LOG(debug) << "invalid channel address: \"" << fAddress << "\""; return false; } else @@ -542,8 +542,8 @@ bool FairMQChannel::ValidateChannel() if (socketMethods.find(fMethod) == socketMethods.end()) { ss << "INVALID"; - LOG(DEBUG) << ss.str(); - LOG(ERROR) << "Invalid endpoint connection method: \"" << fMethod << "\" for " << endpoint; + LOG(debug) << ss.str(); + LOG(error) << "Invalid endpoint connection method: \"" << fMethod << "\" for " << endpoint; exit(EXIT_FAILURE); } address = endpoint; @@ -556,8 +556,8 @@ bool FairMQChannel::ValidateChannel() if (addressString.find(":") == string::npos) { ss << "INVALID"; - LOG(DEBUG) << ss.str(); - LOG(ERROR) << "invalid channel address: \"" << address << "\" (missing port?)"; + LOG(debug) << ss.str(); + LOG(error) << "invalid channel address: \"" << address << "\" (missing port?)"; return false; } } @@ -568,8 +568,8 @@ bool FairMQChannel::ValidateChannel() if (addressString == "") { ss << "INVALID"; - LOG(DEBUG) << ss.str(); - LOG(ERROR) << "invalid channel address: \"" << address << "\" (empty IPC address?)"; + LOG(debug) << ss.str(); + LOG(error) << "invalid channel address: \"" << address << "\" (empty IPC address?)"; return false; } } @@ -580,8 +580,8 @@ bool FairMQChannel::ValidateChannel() if (addressString == "") { ss << "INVALID"; - LOG(DEBUG) << ss.str(); - LOG(ERROR) << "invalid channel address: \"" << address << "\" (empty inproc address?)"; + LOG(debug) << ss.str(); + LOG(error) << "invalid channel address: \"" << address << "\" (empty inproc address?)"; return false; } } @@ -589,8 +589,8 @@ bool FairMQChannel::ValidateChannel() { // if neither TCP or IPC is specified, return invalid ss << "INVALID"; - LOG(DEBUG) << ss.str(); - LOG(ERROR) << "invalid channel address: \"" << address << "\" (missing protocol specifier?)"; + LOG(debug) << ss.str(); + LOG(error) << "invalid channel address: \"" << address << "\" (missing protocol specifier?)"; return false; } } @@ -602,8 +602,8 @@ bool FairMQChannel::ValidateChannel() if (FairMQ::TransportTypes.find(fTransport) == FairMQ::TransportTypes.end()) { ss << "INVALID"; - LOG(DEBUG) << ss.str(); - LOG(ERROR) << "Invalid channel transport: \"" << fTransport << "\""; + LOG(debug) << ss.str(); + LOG(error) << "Invalid channel transport: \"" << fTransport << "\""; exit(EXIT_FAILURE); } @@ -611,8 +611,8 @@ bool FairMQChannel::ValidateChannel() if (fSndBufSize < 0) { ss << "INVALID"; - LOG(DEBUG) << ss.str(); - LOG(ERROR) << "invalid channel send buffer size (cannot be negative): \"" << fSndBufSize << "\""; + LOG(debug) << ss.str(); + LOG(error) << "invalid channel send buffer size (cannot be negative): \"" << fSndBufSize << "\""; exit(EXIT_FAILURE); } @@ -620,8 +620,8 @@ bool FairMQChannel::ValidateChannel() if (fRcvBufSize < 0) { ss << "INVALID"; - LOG(DEBUG) << ss.str(); - LOG(ERROR) << "invalid channel receive buffer size (cannot be negative): \"" << fRcvBufSize << "\""; + LOG(debug) << ss.str(); + LOG(error) << "invalid channel receive buffer size (cannot be negative): \"" << fRcvBufSize << "\""; exit(EXIT_FAILURE); } @@ -629,8 +629,8 @@ bool FairMQChannel::ValidateChannel() if (fSndKernelSize < 0) { ss << "INVALID"; - LOG(DEBUG) << ss.str(); - LOG(ERROR) << "invalid channel send kernel transmit size (cannot be negative): \"" << fSndKernelSize << "\""; + LOG(debug) << ss.str(); + LOG(error) << "invalid channel send kernel transmit size (cannot be negative): \"" << fSndKernelSize << "\""; exit(EXIT_FAILURE); } @@ -638,8 +638,8 @@ bool FairMQChannel::ValidateChannel() if (fRcvKernelSize < 0) { ss << "INVALID"; - LOG(DEBUG) << ss.str(); - LOG(ERROR) << "invalid channel receive kernel transmit size (cannot be negative): \"" << fRcvKernelSize << "\""; + LOG(debug) << ss.str(); + LOG(error) << "invalid channel receive kernel transmit size (cannot be negative): \"" << fRcvKernelSize << "\""; exit(EXIT_FAILURE); } @@ -647,19 +647,19 @@ bool FairMQChannel::ValidateChannel() if (fRateLogging < 0) { ss << "INVALID"; - LOG(DEBUG) << ss.str(); - LOG(ERROR) << "invalid socket rate logging interval (cannot be negative): \"" << fRateLogging << "\""; + LOG(debug) << ss.str(); + LOG(error) << "invalid socket rate logging interval (cannot be negative): \"" << fRateLogging << "\""; exit(EXIT_FAILURE); } fIsValid = true; ss << "VALID"; - LOG(DEBUG) << ss.str(); + LOG(debug) << ss.str(); return true; } catch (exception& e) { - LOG(ERROR) << "Exception caught in FairMQChannel::ValidateChannel: " << e.what(); + LOG(error) << "Exception caught in FairMQChannel::ValidateChannel: " << e.what(); exit(EXIT_FAILURE); } } @@ -839,7 +839,7 @@ inline bool FairMQChannel::HandleUnblock() const FairMQMessagePtr cmd(fTransportFactory->CreateMessage()); if (fChannelCmdSocket->Receive(cmd) >= 0) { - // LOG(DEBUG) << "unblocked"; + // LOG(debug) << "unblocked"; } return true; } @@ -876,7 +876,7 @@ bool FairMQChannel::CheckCompatibility(unique_ptr& msg) const } else { - // LOG(WARN) << "Channel type does not match message type. Copying..."; + // LOG(warn) << "Channel type does not match message type. Copying..."; FairMQMessagePtr msgCopy(fTransportFactory->CreateMessage(msg->GetSize())); memcpy(msgCopy->GetData(), msg->GetData(), msg->GetSize()); msg = move(msgCopy); @@ -894,7 +894,7 @@ bool FairMQChannel::CheckCompatibility(vector>& msgVec { if (fTransportType != msgVec.at(i)->GetType()) { - // LOG(WARN) << "Channel type does not match message type. Copying..."; + // LOG(warn) << "Channel type does not match message type. Copying..."; FairMQMessagePtr newMsg(fTransportFactory->CreateMessage(msgVec[i]->GetSize())); memcpy(newMsg->GetData(), msgVec[i]->GetData(), msgVec[i]->GetSize()); msgVec[i] = move(newMsg); diff --git a/fairmq/FairMQDevice.cxx b/fairmq/FairMQDevice.cxx index 792946fc..acd1e48d 100644 --- a/fairmq/FairMQDevice.cxx +++ b/fairmq/FairMQDevice.cxx @@ -101,7 +101,7 @@ void FairMQDevice::InitWrapper() { if (!fTransportFactory) { - LOG(ERROR) << "Transport not initialized. Did you call SetTransport()?"; + LOG(error) << "Transport not initialized. Did you call SetTransport()?"; exit(EXIT_FAILURE); } @@ -167,7 +167,7 @@ void FairMQDevice::InitWrapper() } else { - LOG(ERROR) << "Cannot update configuration. Socket method (bind/connect) not specified."; + LOG(error) << "Cannot update configuration. Socket method (bind/connect) not specified."; throw runtime_error("Cannot update configuration. Socket method (bind/connect) not specified."); } // } @@ -180,7 +180,7 @@ void FairMQDevice::InitWrapper() if (uninitializedBindingChannels.size() > 0) { - LOG(ERROR) << uninitializedBindingChannels.size() << " of the binding channels could not initialize. Initial configuration incomplete."; + LOG(error) << uninitializedBindingChannels.size() << " of the binding channels could not initialize. Initial configuration incomplete."; throw runtime_error(fair::mq::tools::ToString(uninitializedBindingChannels.size(), " of the binding channels could not initialize. Initial configuration incomplete.")); } @@ -219,7 +219,7 @@ void FairMQDevice::InitWrapper() if (numAttempts++ > maxAttempts) { - LOG(ERROR) << "could not connect all channels after " << fInitializationTimeoutInS << " attempts"; + LOG(error) << "could not connect all channels after " << fInitializationTimeoutInS << " attempts"; throw runtime_error(fair::mq::tools::ToString("could not connect all channels after ", fInitializationTimeoutInS, " attempts")); } @@ -257,7 +257,7 @@ void FairMQDevice::AttachChannels(vector& chans) } else { - LOG(ERROR) << "failed to attach channel " << (*itr)->fName << " (" << (*itr)->fMethod << ")"; + LOG(error) << "failed to attach channel " << (*itr)->fName << " (" << (*itr)->fMethod << ")"; ++itr; } } @@ -274,12 +274,12 @@ bool FairMQDevice::AttachChannel(FairMQChannel& ch) { if (ch.fTransport == "default" || ch.fTransport == fDefaultTransport) { - LOG(DEBUG) << ch.fName << ": using default transport"; + LOG(debug) << ch.fName << ": using default transport"; ch.InitTransport(fTransportFactory); } else { - LOG(DEBUG) << ch.fName << ": channel transport (" << fDefaultTransport << ") overriden to " << ch.fTransport; + LOG(debug) << ch.fName << ": channel transport (" << fDefaultTransport << ") overriden to " << ch.fTransport; ch.InitTransport(AddTransport(ch.fTransport)); } ch.fTransportType = ch.fTransportFactory->GetType(); @@ -348,7 +348,7 @@ bool FairMQDevice::AttachChannel(FairMQChannel& ch) } endpoint += address; - LOG(DEBUG) << "Attached channel " << ch.fName << " to " << endpoint << (bind ? " (bind) " : " (connect) "); + LOG(debug) << "Attached channel " << ch.fName << " to " << endpoint << (bind ? " (bind) " : " (connect) "); // after the book keeping is done, exit in case of errors if (!rc) @@ -392,12 +392,12 @@ bool FairMQDevice::BindEndpoint(FairMQSocket& socket, string& endpoint) // try to bind to the saved port. In case of failure, try random one. while (!socket.Bind(endpoint)) { - LOG(DEBUG) << "Could not bind to configured (TCP) port, trying random port in range " << fPortRangeMin << "-" << fPortRangeMax; + LOG(debug) << "Could not bind to configured (TCP) port, trying random port in range " << fPortRangeMin << "-" << fPortRangeMax; ++numAttempts; if (numAttempts > maxAttempts) { - LOG(ERROR) << "could not bind to any (TCP) port in the given range after " << maxAttempts << " attempts"; + LOG(error) << "could not bind to any (TCP) port in the given range after " << maxAttempts << " attempts"; return false; } @@ -443,7 +443,7 @@ void FairMQDevice::SortChannel(const string& name, const bool reindex) } else { - LOG(ERROR) << "Sorting failed: no channel with the name \"" << name << "\"."; + LOG(error) << "Sorting failed: no channel with the name \"" << name << "\"."; } } @@ -453,7 +453,7 @@ void FairMQDevice::PrintChannel(const string& name) { for (auto vi = fChannels[name].begin(); vi != fChannels[name].end(); ++vi) { - LOG(INFO) << vi->fName << ": " + LOG(info) << vi->fName << ": " << vi->fType << " | " << vi->fMethod << " | " << vi->fAddress << " | " @@ -464,7 +464,7 @@ void FairMQDevice::PrintChannel(const string& name) } else { - LOG(ERROR) << "Printing failed: no channel with the name \"" << name << "\"."; + LOG(error) << "Printing failed: no channel with the name \"" << name << "\"."; } } @@ -472,7 +472,7 @@ void FairMQDevice::RunWrapper() { CallStateChangeCallbacks(RUNNING); - LOG(INFO) << "DEVICE: Running..."; + LOG(info) << "DEVICE: Running..."; // start the rate logger thread thread rateLogger(&FairMQDevice::LogSocketRates, this); @@ -524,8 +524,8 @@ void FairMQDevice::RunWrapper() } catch (const out_of_range& oor) { - LOG(ERROR) << "out of range: " << oor.what(); - LOG(ERROR) << "incorrect/incomplete channel configuration?"; + LOG(error) << "out of range: " << oor.what(); + LOG(error) << "incorrect/incomplete channel configuration?"; } // if Run() exited and the state is still RUNNING, transition to READY. @@ -703,7 +703,7 @@ void FairMQDevice::PollForTransport(const FairMQTransportFactory* factory, const } catch (std::exception& e) { - LOG(ERROR) << "FairMQDevice::PollForTransport() failed: " << e.what() << ", going to ERROR state."; + LOG(error) << "FairMQDevice::PollForTransport() failed: " << e.what() << ", going to ERROR state."; ChangeState(ERROR_FOUND); } } @@ -765,9 +765,9 @@ void FairMQDevice::Pause() while (CheckCurrentState(PAUSED)) { this_thread::sleep_for(chrono::milliseconds(500)); - LOG(DEBUG) << "paused..."; + LOG(debug) << "paused..."; } - LOG(DEBUG) << "Unpausing"; + LOG(debug) << "Unpausing"; } shared_ptr FairMQDevice::AddTransport(const string& transport) @@ -778,7 +778,7 @@ shared_ptr FairMQDevice::AddTransport(const string& tran { auto tr = FairMQTransportFactory::CreateTransportFactory(transport, fId, fConfig); - LOG(DEBUG) << "Adding '" << transport << "' transport to the device."; + LOG(debug) << "Adding '" << transport << "' transport to the device."; pair> trPair(FairMQ::TransportTypes.at(transport), tr); fTransports.insert(trPair); @@ -799,7 +799,7 @@ shared_ptr FairMQDevice::AddTransport(const string& tran } else { - LOG(DEBUG) << "Reusing existing '" << transport << "' transport."; + LOG(debug) << "Reusing existing '" << transport << "' transport."; return i->second; } } @@ -824,7 +824,7 @@ unique_ptr FairMQDevice::MakeTransport(const string& tra #endif else { - LOG(ERROR) << "Unavailable transport requested: " << "\"" << transport << "\"" << ". Available are: " + LOG(error) << "Unavailable transport requested: " << "\"" << transport << "\"" << ". Available are: " << "\"zeromq\"" << "\"shmem\"" #ifdef NANOMSG_FOUND @@ -843,7 +843,7 @@ void FairMQDevice::CreateOwnConfig() fConfig = new FairMQProgOptions(); string id{boost::uuids::to_string(boost::uuids::random_generator()())}; - LOG(WARN) << "No FairMQProgOptions provided, creating one internally and setting device ID to " << id; + LOG(warn) << "No FairMQProgOptions provided, creating one internally and setting device ID to " << id; // dummy argc+argv char arg0[] = "undefined"; // executable name @@ -871,12 +871,12 @@ void FairMQDevice::SetTransport(const string& transport) if (fTransports.empty()) { - LOG(DEBUG) << "Requesting '" << transport << "' as default transport for the device"; + LOG(debug) << "Requesting '" << transport << "' as default transport for the device"; fTransportFactory = AddTransport(transport); } else { - LOG(ERROR) << "Transports container is not empty when setting transport. Setting default twice?"; + LOG(error) << "Transports container is not empty when setting transport. Setting default twice?"; ChangeState(ERROR_FOUND); } } @@ -889,7 +889,7 @@ void FairMQDevice::SetConfig(FairMQProgOptions& config) { if (!fChannels.insert(c).second) { - LOG(WARN) << "FairMQDevice::SetConfig: did not insert channel '" << c.first << "', it is already in the device."; + LOG(warn) << "did not insert channel '" << c.first << "', it is already in the device."; } } fDefaultTransport = config.GetValue("transport"); @@ -960,7 +960,7 @@ void FairMQDevice::LogSocketRates() t0 = get_timestamp(); - LOG(DEBUG) << ": in: <#msgs> () out: <#msgs> ()"; + LOG(debug) << ": in: <#msgs> () out: <#msgs> ()"; while (CheckCurrentState(RUNNING)) { @@ -993,7 +993,7 @@ void FairMQDevice::LogSocketRates() bytesOut.at(i) = bytesOutNew.at(i); msgOut.at(i) = msgOutNew.at(i); - LOG(DEBUG) << filteredChannelNames.at(i) << ": " + LOG(debug) << filteredChannelNames.at(i) << ": " << "in: " << msgPerSecIn.at(i) << " (" << mbPerSecIn.at(i) << " MB) " << "out: " << msgPerSecOut.at(i) << " (" << mbPerSecOut.at(i) << " MB)"; } @@ -1005,8 +1005,6 @@ void FairMQDevice::LogSocketRates() this_thread::sleep_for(chrono::milliseconds(1000)); } } - - // LOG(DEBUG) << "FairMQDevice::LogSocketRates() stopping"; } void FairMQDevice::Unblock() @@ -1073,5 +1071,5 @@ void FairMQDevice::Exit() FairMQDevice::~FairMQDevice() { - LOG(DEBUG) << "Destructing device " << fId; + LOG(debug) << "Destructing device " << fId; } diff --git a/fairmq/FairMQDevice.h b/fairmq/FairMQDevice.h index 89dfb7fc..97375457 100644 --- a/fairmq/FairMQDevice.h +++ b/fairmq/FairMQDevice.h @@ -259,7 +259,7 @@ class FairMQDevice : public FairMQStateMachine { if (type != fChannels.at(chans.at(i)).at(0).Transport()->GetType()) { - LOG(ERROR) << "FairMQDevice::NewPoller() failed: different transports within same poller are not yet supported. Going to ERROR state."; + LOG(error) << "poller failed: different transports within same poller are not yet supported. Going to ERROR state."; ChangeState(ERROR_FOUND); } } @@ -279,7 +279,7 @@ class FairMQDevice : public FairMQStateMachine { if (type != channels.at(i)->Transport()->GetType()) { - LOG(ERROR) << "FairMQDevice::NewPoller() failed: different transports within same poller are not yet supported. Going to ERROR state."; + LOG(error) << "poller failed: different transports within same poller are not yet supported. Going to ERROR state."; ChangeState(ERROR_FOUND); } } @@ -374,7 +374,7 @@ class FairMQDevice : public FairMQStateMachine bool ok = fChannelRegistry.insert(std::make_pair(channelName, std::make_pair(minNumSubChannels, maxNumSubChannels))).second; if (!ok) { - LOG(WARN) << "Registering channel: name already registered: \"" << channelName << "\""; + LOG(warn) << "Registering channel: name already registered: \"" << channelName << "\""; } return ok; } diff --git a/fairmq/FairMQStateMachine.cxx b/fairmq/FairMQStateMachine.cxx index 00e188ae..b524c993 100644 --- a/fairmq/FairMQStateMachine.cxx +++ b/fairmq/FairMQStateMachine.cxx @@ -109,7 +109,7 @@ bool FairMQStateMachine::ChangeState(int event) } default: { - LOG(ERROR) << "Requested state transition with an unsupported event: " << event << std::endl + LOG(error) << "Requested state transition with an unsupported event: " << event << std::endl << "Supported are: INIT_DEVICE, INIT_TASK, RUN, PAUSE, STOP, RESET_TASK, RESET_DEVICE, END, ERROR_FOUND"; return false; } @@ -117,7 +117,7 @@ bool FairMQStateMachine::ChangeState(int event) } catch (std::exception& e) { - LOG(ERROR) << "Exception in FairMQStateMachine::ChangeState(): " << e.what(); + LOG(error) << "Exception in FairMQStateMachine::ChangeState(): " << e.what(); exit(EXIT_FAILURE); } return false; @@ -149,13 +149,13 @@ void FairMQStateMachine::WaitForEndOfState(int event) break; } default: - LOG(ERROR) << "Requested state is either synchronous or does not exist."; + LOG(error) << "Requested state is either synchronous or does not exist."; break; } } catch (std::exception& e) { - LOG(ERROR) << "Exception in FairMQStateMachine::WaitForEndOfState(): " << e.what(); + LOG(error) << "Exception in FairMQStateMachine::WaitForEndOfState(): " << e.what(); } } @@ -188,13 +188,13 @@ bool FairMQStateMachine::WaitForEndOfStateForMs(int event, int durationInMs) return true; } default: - LOG(ERROR) << "Requested state is either synchronous or does not exist."; + LOG(error) << "Requested state is either synchronous or does not exist."; return false; } } catch (std::exception& e) { - LOG(ERROR) << "Exception in FairMQStateMachine::WaitForEndOfStateForMs(): " << e.what(); + LOG(error) << "Exception in FairMQStateMachine::WaitForEndOfStateForMs(): " << e.what(); } return false; } @@ -225,7 +225,7 @@ int FairMQStateMachine::GetEventNumber(const std::string& event) if (event == "RESET_TASK") return RESET_TASK; if (event == "END") return END; if (event == "ERROR_FOUND") return ERROR_FOUND; - LOG(ERROR) << "Requested number for non-existent event... " << event << std::endl + LOG(error) << "Requested number for non-existent event... " << event << std::endl << "Supported are: INIT_DEVICE, INIT_TASK, RUN, PAUSE, STOP, RESET_DEVICE, RESET_TASK, END, ERROR_FOUND"; return -1; } \ No newline at end of file diff --git a/fairmq/FairMQStateMachine.h b/fairmq/FairMQStateMachine.h index b97a96b3..f85b393e 100644 --- a/fairmq/FairMQStateMachine.h +++ b/fairmq/FairMQStateMachine.h @@ -99,7 +99,7 @@ struct FairMQFSM : public msmf::state_machine_def template void on_entry(Event const&, FSM& fsm) { - LOG(STATE) << "Starting FairMQ state machine"; + LOG(state) << "Starting FairMQ state machine"; fState = IDLE; fsm.CallStateChangeCallbacks(IDLE); @@ -110,7 +110,7 @@ struct FairMQFSM : public msmf::state_machine_def template void on_exit(Event const&, FSM& /*fsm*/) { - LOG(STATE) << "Exiting FairMQ state machine"; + LOG(state) << "Exiting FairMQ state machine"; } // list of FSM states @@ -137,7 +137,7 @@ struct FairMQFSM : public msmf::state_machine_def template void operator()(EVT const&, FSM& fsm, SourceState&, TargetState&) { - LOG(STATE) << "Entering IDLE state"; + LOG(state) << "Entering IDLE state"; fsm.fState = IDLE; } }; @@ -155,7 +155,7 @@ struct FairMQFSM : public msmf::state_machine_def fsm.fWorkDoneCondition.wait(lock); } fsm.fWorkAvailable = true; - LOG(STATE) << "Entering INITIALIZING DEVICE state"; + LOG(state) << "Entering INITIALIZING DEVICE state"; fsm.fWork = std::bind(&FairMQFSM::InitWrapper, &fsm); fsm.fWorkAvailableCondition.notify_one(); } @@ -166,7 +166,7 @@ struct FairMQFSM : public msmf::state_machine_def template void operator()(EVT const&, FSM& fsm, SourceState&, TargetState&) { - LOG(STATE) << "Entering DEVICE READY state"; + LOG(state) << "Entering DEVICE READY state"; fsm.fState = DEVICE_READY; } }; @@ -184,7 +184,7 @@ struct FairMQFSM : public msmf::state_machine_def fsm.fWorkDoneCondition.wait(lock); } fsm.fWorkAvailable = true; - LOG(STATE) << "Entering INITIALIZING TASK state"; + LOG(state) << "Entering INITIALIZING TASK state"; fsm.fWork = std::bind(&FairMQFSM::InitTaskWrapper, &fsm); fsm.fWorkAvailableCondition.notify_one(); } @@ -195,7 +195,7 @@ struct FairMQFSM : public msmf::state_machine_def template void operator()(EVT const&, FSM& fsm, SourceState&, TargetState&) { - LOG(STATE) << "Entering READY state"; + LOG(state) << "Entering READY state"; fsm.fState = READY; } }; @@ -213,7 +213,7 @@ struct FairMQFSM : public msmf::state_machine_def fsm.fWorkDoneCondition.wait(lock); } fsm.fWorkAvailable = true; - LOG(STATE) << "Entering RUNNING state"; + LOG(state) << "Entering RUNNING state"; fsm.fWork = std::bind(&FairMQFSM::RunWrapper, &fsm); fsm.fWorkAvailableCondition.notify_one(); } @@ -233,7 +233,7 @@ struct FairMQFSM : public msmf::state_machine_def fsm.fWorkDoneCondition.wait(lock); } fsm.fWorkAvailable = true; - LOG(STATE) << "Entering PAUSED state"; + LOG(state) << "Entering PAUSED state"; fsm.fWork = std::bind(&FairMQFSM::PauseWrapper, &fsm); fsm.fWorkAvailableCondition.notify_one(); } @@ -252,7 +252,7 @@ struct FairMQFSM : public msmf::state_machine_def fsm.fWorkDoneCondition.wait(lock); } fsm.fWorkAvailable = true; - LOG(STATE) << "Entering RUNNING state"; + LOG(state) << "Entering RUNNING state"; fsm.fWork = std::bind(&FairMQFSM::RunWrapper, &fsm); fsm.fWorkAvailableCondition.notify_one(); } @@ -271,7 +271,7 @@ struct FairMQFSM : public msmf::state_machine_def { fsm.fWorkDoneCondition.wait(lock); } - LOG(STATE) << "Entering READY state"; + LOG(state) << "Entering READY state"; } }; @@ -282,7 +282,7 @@ struct FairMQFSM : public msmf::state_machine_def { fsm.fState = READY; fsm.Unblock(); - LOG(STATE) << "RUNNING state finished without an external event, entering READY state"; + LOG(state) << "RUNNING state finished without an external event, entering READY state"; } }; @@ -299,7 +299,7 @@ struct FairMQFSM : public msmf::state_machine_def fsm.fWorkDoneCondition.wait(lock); } fsm.fWorkAvailable = true; - LOG(STATE) << "Entering RESETTING TASK state"; + LOG(state) << "Entering RESETTING TASK state"; fsm.fWork = std::bind(&FairMQFSM::ResetTaskWrapper, &fsm); fsm.fWorkAvailableCondition.notify_one(); } @@ -318,7 +318,7 @@ struct FairMQFSM : public msmf::state_machine_def fsm.fWorkDoneCondition.wait(lock); } fsm.fWorkAvailable = true; - LOG(STATE) << "Entering RESETTING DEVICE state"; + LOG(state) << "Entering RESETTING DEVICE state"; fsm.fWork = std::bind(&FairMQFSM::ResetWrapper, &fsm); fsm.fWorkAvailableCondition.notify_one(); } @@ -329,7 +329,7 @@ struct FairMQFSM : public msmf::state_machine_def template void operator()(EVT const&, FSM& fsm, SourceState&, TargetState&) { - LOG(STATE) << "Entering EXITING state"; + LOG(state) << "Entering EXITING state"; fsm.fState = EXITING; fsm.fTerminationRequested = true; fsm.CallStateChangeCallbacks(EXITING); @@ -356,7 +356,7 @@ struct FairMQFSM : public msmf::state_machine_def template void operator()(EVT const&, FSM& fsm, SourceState&, TargetState&) { - LOG(STATE) << "Entering ERROR state"; + LOG(state) << "Entering ERROR state"; fsm.fState = Error; fsm.CallStateChangeCallbacks(Error); } @@ -404,10 +404,10 @@ struct FairMQFSM : public msmf::state_machine_def if (stateName != "OK") { - LOG(STATE) << "No transition from state " << stateName << " on event " << e.name(); + LOG(state) << "No transition from state " << stateName << " on event " << e.name(); } - // LOG(STATE) << "no transition from state " << GetStateName(state) << " (" << state << ") on event " << e.name(); + // LOG(state) << "no transition from state " << GetStateName(state) << " (" << state << ") on event " << e.name(); } // backward compatibility to FairMQStateMachine diff --git a/fairmq/FairMQTransportFactory.cxx b/fairmq/FairMQTransportFactory.cxx index 7496e3c5..01a5f912 100644 --- a/fairmq/FairMQTransportFactory.cxx +++ b/fairmq/FairMQTransportFactory.cxx @@ -52,7 +52,7 @@ auto FairMQTransportFactory::CreateTransportFactory(const std::string& type, con #endif /* NANOMSG_FOUND */ else { - LOG(ERROR) << "Unavailable transport requested: " << "\"" << type << "\"" << ". Available are: " + LOG(error) << "Unavailable transport requested: " << "\"" << type << "\"" << ". Available are: " << "\"zeromq\"" << "\"shmem\"" #ifdef NANOMSG_FOUND diff --git a/fairmq/Plugin.cxx b/fairmq/Plugin.cxx index 8b70bef8..a814105b 100644 --- a/fairmq/Plugin.cxx +++ b/fairmq/Plugin.cxx @@ -18,10 +18,10 @@ fair::mq::Plugin::Plugin(const string name, const Version version, const string , fkHomepage{homepage} , fPluginServices{pluginServices} { - LOG(DEBUG) << "Loaded plugin: " << *this; + LOG(debug) << "Loaded plugin: " << *this; } fair::mq::Plugin::~Plugin() { - LOG(DEBUG) << "Unloaded plugin: " << *this; + LOG(debug) << "Unloaded plugin: " << *this; } diff --git a/fairmq/StateMachine.cxx b/fairmq/StateMachine.cxx index d7fbe3fe..3cbad339 100644 --- a/fairmq/StateMachine.cxx +++ b/fairmq/StateMachine.cxx @@ -62,10 +62,10 @@ const std::unordered_map void { - LOG(STATE) << "Starting FairMQ state machine"; + LOG(state) << "Starting FairMQ state machine"; - LOG(DEBUG) << "Entering initial " << fErrorState << " state (orthogonal error state machine)"; - LOG(STATE) << "Entering initial " << fState << " state"; + LOG(debug) << "Entering initial " << fErrorState << " state (orthogonal error state machine)"; + LOG(state) << "Entering initial " << fState << " state"; std::unique_lock lock{fMutex}; while (true) @@ -83,7 +83,7 @@ auto StateMachine::Run() -> void lastState = fErrorState; fErrorState = fNextStates.front(); fNextStates.pop_front(); - LOG(ERROR) << "Entering " << fErrorState << " state (orthogonal error state machine)"; + LOG(error) << "Entering " << fErrorState << " state (orthogonal error state machine)"; } else { @@ -91,7 +91,7 @@ auto StateMachine::Run() -> void lastState = fState; fState = fNextStates.front(); fNextStates.pop_front(); - LOG(STATE) << "Entering " << fState << " state"; + LOG(state) << "Entering " << fState << " state"; } lock.unlock(); @@ -101,7 +101,7 @@ auto StateMachine::Run() -> void if (fState == State::Exiting || fErrorState == State::Error) break; } - LOG(STATE) << "Exiting FairMQ state machine"; + LOG(state) << "Exiting FairMQ state machine"; } auto StateMachine::ChangeState(StateTransition transition) -> void diff --git a/fairmq/devices/FairMQBenchmarkSampler.cxx b/fairmq/devices/FairMQBenchmarkSampler.cxx index 14e80055..b2e13a84 100644 --- a/fairmq/devices/FairMQBenchmarkSampler.cxx +++ b/fairmq/devices/FairMQBenchmarkSampler.cxx @@ -59,7 +59,7 @@ void FairMQBenchmarkSampler::Run() FairMQMessagePtr baseMsg(dataOutChannel.Transport()->CreateMessage(fMsgSize)); - LOG(INFO) << "Starting the benchmark with message size of " << fMsgSize << " and " << fMaxIterations << " iterations."; + LOG(info) << "Starting the benchmark with message size of " << fMsgSize << " and " << fMaxIterations << " iterations."; auto tStart = chrono::high_resolution_clock::now(); while (CheckCurrentState(RUNNING)) @@ -108,7 +108,7 @@ void FairMQBenchmarkSampler::Run() auto tEnd = chrono::high_resolution_clock::now(); - LOG(INFO) << "Done " << fNumIterations << " iterations in " << chrono::duration(tEnd - tStart).count() << "ms."; + LOG(info) << "Done " << fNumIterations << " iterations in " << chrono::duration(tEnd - tStart).count() << "ms."; } diff --git a/fairmq/devices/FairMQMerger.cxx b/fairmq/devices/FairMQMerger.cxx index 4bb25f84..c7cd3574 100644 --- a/fairmq/devices/FairMQMerger.cxx +++ b/fairmq/devices/FairMQMerger.cxx @@ -74,13 +74,13 @@ void FairMQMerger::Run() { if (Send(payload, fOutChannelName) < 0) { - LOG(DEBUG) << "Transfer interrupted"; + LOG(debug) << "Transfer interrupted"; break; } } else { - LOG(DEBUG) << "Transfer interrupted"; + LOG(debug) << "Transfer interrupted"; break; } } @@ -105,13 +105,13 @@ void FairMQMerger::Run() { if (Send(payload, fOutChannelName) < 0) { - LOG(DEBUG) << "Transfer interrupted"; + LOG(debug) << "Transfer interrupted"; break; } } else { - LOG(DEBUG) << "Transfer interrupted"; + LOG(debug) << "Transfer interrupted"; break; } } diff --git a/fairmq/devices/FairMQProxy.cxx b/fairmq/devices/FairMQProxy.cxx index 22b6077b..ee802e89 100644 --- a/fairmq/devices/FairMQProxy.cxx +++ b/fairmq/devices/FairMQProxy.cxx @@ -48,13 +48,13 @@ void FairMQProxy::Run() { if (Send(payload, fOutChannelName) < 0) { - LOG(DEBUG) << "Transfer interrupted"; + LOG(debug) << "Transfer interrupted"; break; } } else { - LOG(DEBUG) << "Transfer interrupted"; + LOG(debug) << "Transfer interrupted"; break; } } @@ -68,13 +68,13 @@ void FairMQProxy::Run() { if (Send(payload, fOutChannelName) < 0) { - LOG(DEBUG) << "Transfer interrupted"; + LOG(debug) << "Transfer interrupted"; break; } } else { - LOG(DEBUG) << "Transfer interrupted"; + LOG(debug) << "Transfer interrupted"; break; } } diff --git a/fairmq/devices/FairMQSink.cxx b/fairmq/devices/FairMQSink.cxx index 7e63a3a6..b792d6e4 100644 --- a/fairmq/devices/FairMQSink.cxx +++ b/fairmq/devices/FairMQSink.cxx @@ -39,7 +39,7 @@ void FairMQSink::Run() // store the channel reference to avoid traversing the map on every loop iteration FairMQChannel& dataInChannel = fChannels.at(fInChannelName).at(0); - LOG(INFO) << "Starting the benchmark and expecting to receive " << fNumMsgs << " messages."; + LOG(info) << "Starting the benchmark and expecting to receive " << fNumMsgs << " messages."; auto tStart = chrono::high_resolution_clock::now(); while (CheckCurrentState(RUNNING)) @@ -61,7 +61,7 @@ void FairMQSink::Run() auto tEnd = chrono::high_resolution_clock::now(); - LOG(INFO) << "Leaving RUNNING state. Received " << numReceivedMsgs << " messages in " << chrono::duration(tEnd - tStart).count() << "ms."; + LOG(info) << "Leaving RUNNING state. Received " << numReceivedMsgs << " messages in " << chrono::duration(tEnd - tStart).count() << "ms."; } FairMQSink::~FairMQSink() diff --git a/fairmq/devices/FairMQSink.h b/fairmq/devices/FairMQSink.h index 863049e7..6746bf07 100644 --- a/fairmq/devices/FairMQSink.h +++ b/fairmq/devices/FairMQSink.h @@ -51,7 +51,7 @@ class FairMQSink : public FairMQDevice//, public OutputPolicy // store the channel reference to avoid traversing the map on every loop iteration FairMQChannel& dataInChannel = fChannels.at(fInChannelName).at(0); - LOG(INFO) << "Starting the benchmark and expecting to receive " << fMaxIterations << " messages."; + LOG(info) << "Starting the benchmark and expecting to receive " << fMaxIterations << " messages."; auto tStart = std::chrono::high_resolution_clock::now(); while (CheckCurrentState(RUNNING)) @@ -73,7 +73,7 @@ class FairMQSink : public FairMQDevice//, public OutputPolicy auto tEnd = std::chrono::high_resolution_clock::now(); - LOG(INFO) << "Leaving RUNNING state. Received " << fNumIterations << " messages in " << std::chrono::duration(tEnd - tStart).count() << "ms."; + LOG(info) << "Leaving RUNNING state. Received " << fNumIterations << " messages in " << std::chrono::duration(tEnd - tStart).count() << "ms."; } }; diff --git a/fairmq/nanomsg/FairMQMessageNN.cxx b/fairmq/nanomsg/FairMQMessageNN.cxx index 71cba27c..bc1a87fe 100644 --- a/fairmq/nanomsg/FairMQMessageNN.cxx +++ b/fairmq/nanomsg/FairMQMessageNN.cxx @@ -34,7 +34,7 @@ FairMQMessageNN::FairMQMessageNN() fMessage = nn_allocmsg(0, 0); if (!fMessage) { - LOG(ERROR) << "failed allocating message, reason: " << nn_strerror(errno); + LOG(error) << "failed allocating message, reason: " << nn_strerror(errno); } } @@ -48,7 +48,7 @@ FairMQMessageNN::FairMQMessageNN(const size_t size) fMessage = nn_allocmsg(size, 0); if (!fMessage) { - LOG(ERROR) << "failed allocating message, reason: " << nn_strerror(errno); + LOG(error) << "failed allocating message, reason: " << nn_strerror(errno); } fSize = size; } @@ -69,7 +69,7 @@ FairMQMessageNN::FairMQMessageNN(void* data, const size_t size, fairmq_free_fn* fMessage = nn_allocmsg(size, 0); if (!fMessage) { - LOG(ERROR) << "failed allocating message, reason: " << nn_strerror(errno); + LOG(error) << "failed allocating message, reason: " << nn_strerror(errno); } else { @@ -108,7 +108,7 @@ void FairMQMessageNN::Rebuild(const size_t size) fMessage = nn_allocmsg(size, 0); if (!fMessage) { - LOG(ERROR) << "failed allocating message, reason: " << nn_strerror(errno); + LOG(error) << "failed allocating message, reason: " << nn_strerror(errno); } fSize = size; fReceiving = false; @@ -120,7 +120,7 @@ void FairMQMessageNN::Rebuild(void* data, const size_t size, fairmq_free_fn* ffn fMessage = nn_allocmsg(size, 0); if (!fMessage) { - LOG(ERROR) << "failed allocating message, reason: " << nn_strerror(errno); + LOG(error) << "failed allocating message, reason: " << nn_strerror(errno); } else { @@ -161,7 +161,7 @@ bool FairMQMessageNN::SetUsedSize(const size_t size) } else { - LOG(ERROR) << "FairMQMessageNN::SetUsedSize: cannot set used size higher than original."; + LOG(error) << "cannot set used size higher than original."; return false; } } @@ -183,7 +183,7 @@ void FairMQMessageNN::Copy(const FairMQMessage& msg) { if (nn_freemsg(fMessage) < 0) { - LOG(ERROR) << "failed freeing message, reason: " << nn_strerror(errno); + LOG(error) << "failed freeing message, reason: " << nn_strerror(errno); } } @@ -192,7 +192,7 @@ void FairMQMessageNN::Copy(const FairMQMessage& msg) fMessage = nn_allocmsg(size, 0); if (!fMessage) { - LOG(ERROR) << "failed allocating message, reason: " << nn_strerror(errno); + LOG(error) << "failed allocating message, reason: " << nn_strerror(errno); } else { @@ -207,7 +207,7 @@ void FairMQMessageNN::Copy(const FairMQMessagePtr& msg) { if (nn_freemsg(fMessage) < 0) { - LOG(ERROR) << "failed freeing message, reason: " << nn_strerror(errno); + LOG(error) << "failed freeing message, reason: " << nn_strerror(errno); } } @@ -216,7 +216,7 @@ void FairMQMessageNN::Copy(const FairMQMessagePtr& msg) fMessage = nn_allocmsg(size, 0); if (!fMessage) { - LOG(ERROR) << "failed allocating message, reason: " << nn_strerror(errno); + LOG(error) << "failed allocating message, reason: " << nn_strerror(errno); } else { @@ -229,7 +229,7 @@ void FairMQMessageNN::CloseMessage() { if (nn_freemsg(fMessage) < 0) { - LOG(ERROR) << "failed freeing message, reason: " << nn_strerror(errno); + LOG(error) << "failed freeing message, reason: " << nn_strerror(errno); } else { diff --git a/fairmq/nanomsg/FairMQPollerNN.cxx b/fairmq/nanomsg/FairMQPollerNN.cxx index 17a1998a..09f7e1d5 100644 --- a/fairmq/nanomsg/FairMQPollerNN.cxx +++ b/fairmq/nanomsg/FairMQPollerNN.cxx @@ -100,8 +100,8 @@ FairMQPollerNN::FairMQPollerNN(const unordered_map } catch (const std::out_of_range& oor) { - LOG(ERROR) << "nanomsg: at least one of the provided channel keys for poller initialization is invalid"; - LOG(ERROR) << "nanomsg: out of range error: " << oor.what() << '\n'; + LOG(error) << "at least one of the provided channel keys for poller initialization is invalid"; + LOG(error) << "out of range error: " << oor.what() << '\n'; exit(EXIT_FAILURE); } } @@ -143,7 +143,7 @@ void FairMQPollerNN::SetItemEvents(nn_pollfd& item, const int type) } else { - LOG(ERROR) << "nanomsg: invalid poller configuration, exiting."; + LOG(error) << "invalid poller configuration, exiting."; exit(EXIT_FAILURE); } } @@ -154,12 +154,12 @@ void FairMQPollerNN::Poll(const int timeout) { if (errno == ETERM) { - LOG(DEBUG) << "nanomsg: polling exited, reason: " << nn_strerror(errno); + LOG(debug) << "polling exited, reason: " << nn_strerror(errno); } else { - LOG(ERROR) << "nanomsg: polling failed, reason: " << nn_strerror(errno); - throw std::runtime_error("nanomsg: polling failed"); + LOG(error) << "polling failed, reason: " << nn_strerror(errno); + throw std::runtime_error("polling failed"); } } } @@ -197,8 +197,8 @@ bool FairMQPollerNN::CheckInput(const string channelKey, const int index) } catch (const std::out_of_range& oor) { - LOG(ERROR) << "nanomsg: invalid channel key: \"" << channelKey << "\""; - LOG(ERROR) << "nanomsg: out of range error: " << oor.what() << '\n'; + LOG(error) << "invalid channel key: \"" << channelKey << "\""; + LOG(error) << "out of range error: " << oor.what() << '\n'; exit(EXIT_FAILURE); } } @@ -216,8 +216,8 @@ bool FairMQPollerNN::CheckOutput(const string channelKey, const int index) } catch (const std::out_of_range& oor) { - LOG(ERROR) << "nanomsg: invalid channel key: \"" << channelKey << "\""; - LOG(ERROR) << "nanomsg: out of range error: " << oor.what() << '\n'; + LOG(error) << "invalid channel key: \"" << channelKey << "\""; + LOG(error) << "out of range error: " << oor.what() << '\n'; exit(EXIT_FAILURE); } } diff --git a/fairmq/nanomsg/FairMQSocketNN.cxx b/fairmq/nanomsg/FairMQSocketNN.cxx index 6785b7e6..27d1f0af 100644 --- a/fairmq/nanomsg/FairMQSocketNN.cxx +++ b/fairmq/nanomsg/FairMQSocketNN.cxx @@ -51,7 +51,7 @@ FairMQSocketNN::FairMQSocketNN(const string& type, const string& name, const str fSocket = nn_socket(AF_SP_RAW, GetConstant(type)); if (fSocket == -1) { - LOG(ERROR) << "failed creating socket " << fId << ", reason: " << nn_strerror(errno); + LOG(error) << "failed creating socket " << fId << ", reason: " << nn_strerror(errno); exit(EXIT_FAILURE); } } @@ -60,7 +60,7 @@ FairMQSocketNN::FairMQSocketNN(const string& type, const string& name, const str fSocket = nn_socket(AF_SP, GetConstant(type)); if (fSocket == -1) { - LOG(ERROR) << "failed creating socket " << fId << ", reason: " << nn_strerror(errno); + LOG(error) << "failed creating socket " << fId << ", reason: " << nn_strerror(errno); exit(EXIT_FAILURE); } if (type == "sub") @@ -72,24 +72,24 @@ FairMQSocketNN::FairMQSocketNN(const string& type, const string& name, const str int sndTimeout = 700; if (nn_setsockopt(fSocket, NN_SOL_SOCKET, NN_SNDTIMEO, &sndTimeout, sizeof(sndTimeout)) != 0) { - LOG(ERROR) << "Failed setting NN_SNDTIMEO socket option, reason: " << nn_strerror(errno); + LOG(error) << "Failed setting NN_SNDTIMEO socket option, reason: " << nn_strerror(errno); } int rcvTimeout = 700; if (nn_setsockopt(fSocket, NN_SOL_SOCKET, NN_RCVTIMEO, &rcvTimeout, sizeof(rcvTimeout)) != 0) { - LOG(ERROR) << "Failed setting NN_RCVTIMEO socket option, reason: " << nn_strerror(errno); + LOG(error) << "Failed setting NN_RCVTIMEO socket option, reason: " << nn_strerror(errno); } #ifdef NN_RCVMAXSIZE int rcvSize = -1; if (nn_setsockopt(fSocket, NN_SOL_SOCKET, NN_RCVMAXSIZE, &rcvSize, sizeof(rcvSize)) != 0) { - LOG(ERROR) << "Failed setting NN_RCVMAXSIZE socket option, reason: " << nn_strerror(errno); + LOG(error) << "Failed setting NN_RCVMAXSIZE socket option, reason: " << nn_strerror(errno); } #endif - // LOG(INFO) << "created socket " << fId; + // LOG(info) << "created socket " << fId; } string FairMQSocketNN::GetId() @@ -99,12 +99,12 @@ string FairMQSocketNN::GetId() bool FairMQSocketNN::Bind(const string& address) { - // LOG(INFO) << "bind socket " << fId << " on " << address; + // LOG(info) << "bind socket " << fId << " on " << address; int eid = nn_bind(fSocket, address.c_str()); if (eid < 0) { - LOG(ERROR) << "failed binding socket " << fId << ", reason: " << nn_strerror(errno); + LOG(error) << "failed binding socket " << fId << ", reason: " << nn_strerror(errno); return false; } return true; @@ -112,12 +112,12 @@ bool FairMQSocketNN::Bind(const string& address) void FairMQSocketNN::Connect(const string& address) { - // LOG(INFO) << "connect socket " << fId << " to " << address; + // LOG(info) << "connect socket " << fId << " to " << address; int eid = nn_connect(fSocket, address.c_str()); if (eid < 0) { - LOG(ERROR) << "failed connecting socket " << fId << ", reason: " << nn_strerror(errno); + LOG(error) << "failed connecting socket " << fId << ", reason: " << nn_strerror(errno); } } @@ -170,12 +170,12 @@ int FairMQSocketNN::Send(FairMQMessagePtr& msg, const int flags) } else if (nn_errno() == ETERM) { - LOG(INFO) << "terminating socket " << fId; + LOG(info) << "terminating socket " << fId; return -1; } else { - LOG(ERROR) << "Failed sending on socket " << fId << ", reason: " << nn_strerror(errno); + LOG(error) << "Failed sending on socket " << fId << ", reason: " << nn_strerror(errno); return nbytes; } } @@ -220,12 +220,12 @@ int FairMQSocketNN::Receive(FairMQMessagePtr& msg, const int flags) } else if (nn_errno() == ETERM) { - LOG(INFO) << "terminating socket " << fId; + LOG(info) << "terminating socket " << fId; return -1; } else { - LOG(ERROR) << "Failed receiving on socket " << fId << ", reason: " << nn_strerror(errno); + LOG(error) << "Failed receiving on socket " << fId << ", reason: " << nn_strerror(errno); return nbytes; } } @@ -288,17 +288,17 @@ int64_t FairMQSocketNN::Send(vector& msgVec, const int flags) } else if (nn_errno() == ETERM) { - LOG(INFO) << "terminating socket " << fId; + LOG(info) << "terminating socket " << fId; return -1; } else { - LOG(ERROR) << "Failed sending on socket " << fId << ", reason: " << nn_strerror(errno); + LOG(error) << "Failed sending on socket " << fId << ", reason: " << nn_strerror(errno); return nbytes; } } #else /*MSGPACK_FOUND*/ - LOG(ERROR) << "Cannot send message from vector of size " << vecSize << " and flags " << flags << " with nanomsg multipart because MessagePack is not available."; + LOG(error) << "Cannot send message from vector of size " << vecSize << " and flags " << flags << " with nanomsg multipart because MessagePack is not available."; exit(EXIT_FAILURE); #endif /*MSGPACK_FOUND*/ } @@ -309,7 +309,7 @@ int64_t FairMQSocketNN::Receive(vector& msgVec, const int flag // Warn if the vector is filled before Receive() and empty it. // if (msgVec.size() > 0) // { - // LOG(WARN) << "Message vector contains elements before Receive(), they will be deleted!"; + // LOG(warn) << "Message vector contains elements before Receive(), they will be deleted!"; // msgVec.clear(); // } @@ -370,17 +370,17 @@ int64_t FairMQSocketNN::Receive(vector& msgVec, const int flag } else if (nn_errno() == ETERM) { - LOG(INFO) << "terminating socket " << fId; + LOG(info) << "terminating socket " << fId; return -1; } else { - LOG(ERROR) << "Failed receiving on socket " << fId << ", reason: " << nn_strerror(errno); + LOG(error) << "Failed receiving on socket " << fId << ", reason: " << nn_strerror(errno); return nbytes; } } #else /*MSGPACK_FOUND*/ - LOG(ERROR) << "Cannot receive message into vector of size " << msgVec.size() << " and flags " << flags << " with nanomsg multipart because MessagePack is not available."; + LOG(error) << "Cannot receive message into vector of size " << msgVec.size() << " and flags " << flags << " with nanomsg multipart because MessagePack is not available."; exit(EXIT_FAILURE); #endif /*MSGPACK_FOUND*/ } @@ -417,7 +417,7 @@ void FairMQSocketNN::SetOption(const string& option, const void* value, size_t v int val = *(static_cast(const_cast(value))); if (val <= 0) { - LOG(WARN) << "nanomsg: value for sndKernelSize/rcvKernelSize should be greater than 0, using defaults (128kB)."; + LOG(warn) << "value for sndKernelSize/rcvKernelSize should be greater than 0, using defaults (128kB)."; return; } } @@ -430,7 +430,7 @@ void FairMQSocketNN::SetOption(const string& option, const void* value, size_t v int rc = nn_setsockopt(fSocket, NN_SOL_SOCKET, GetConstant(option), value, valueSize); if (rc < 0) { - LOG(ERROR) << "failed setting socket option, reason: " << nn_strerror(errno); + LOG(error) << "failed setting socket option, reason: " << nn_strerror(errno); } } @@ -439,7 +439,7 @@ void FairMQSocketNN::GetOption(const string& option, void* value, size_t* valueS int rc = nn_getsockopt(fSocket, NN_SOL_SOCKET, GetConstant(option), value, valueSize); if (rc < 0) { - LOG(ERROR) << "failed getting socket option, reason: " << nn_strerror(errno); + LOG(error) << "failed getting socket option, reason: " << nn_strerror(errno); } } @@ -467,7 +467,7 @@ bool FairMQSocketNN::SetSendTimeout(const int timeout, const string& /*address*/ { if (nn_setsockopt(fSocket, NN_SOL_SOCKET, NN_SNDTIMEO, &timeout, sizeof(int)) != 0) { - LOG(ERROR) << "Failed setting option 'send timeout' on socket " << fId << ", reason: " << nn_strerror(errno); + LOG(error) << "Failed setting option 'send timeout' on socket " << fId << ", reason: " << nn_strerror(errno); return false; } @@ -481,7 +481,7 @@ int FairMQSocketNN::GetSendTimeout() const if (nn_getsockopt(fSocket, NN_SOL_SOCKET, NN_SNDTIMEO, &timeout, &size) != 0) { - LOG(ERROR) << "Failed getting option 'send timeout' on socket " << fId << ", reason: " << nn_strerror(errno); + LOG(error) << "Failed getting option 'send timeout' on socket " << fId << ", reason: " << nn_strerror(errno); } return timeout; @@ -491,7 +491,7 @@ bool FairMQSocketNN::SetReceiveTimeout(const int timeout, const string& /*addres { if (nn_setsockopt(fSocket, NN_SOL_SOCKET, NN_RCVTIMEO, &timeout, sizeof(int)) != 0) { - LOG(ERROR) << "Failed setting option 'receive timeout' on socket " << fId << ", reason: " << nn_strerror(errno); + LOG(error) << "Failed setting option 'receive timeout' on socket " << fId << ", reason: " << nn_strerror(errno); return false; } @@ -505,7 +505,7 @@ int FairMQSocketNN::GetReceiveTimeout() const if (nn_getsockopt(fSocket, NN_SOL_SOCKET, NN_RCVTIMEO, &timeout, &size) != 0) { - LOG(ERROR) << "Failed getting option 'receive timeout' on socket " << fId << ", reason: " << nn_strerror(errno); + LOG(error) << "Failed getting option 'receive timeout' on socket " << fId << ", reason: " << nn_strerror(errno); } return timeout; @@ -548,12 +548,12 @@ int FairMQSocketNN::GetConstant(const string& constant) return NN_RCVBUF; if (constant == "snd-more") { - LOG(ERROR) << "Multipart messages functionality currently not supported by nanomsg!"; + LOG(error) << "Multipart messages functionality currently not supported by nanomsg!"; return -1; } if (constant == "rcv-more") { - LOG(ERROR) << "Multipart messages functionality currently not supported by nanomsg!"; + LOG(error) << "Multipart messages functionality currently not supported by nanomsg!"; return -1; } diff --git a/fairmq/nanomsg/FairMQTransportFactoryNN.cxx b/fairmq/nanomsg/FairMQTransportFactoryNN.cxx index 239d6b1b..9082eb1c 100644 --- a/fairmq/nanomsg/FairMQTransportFactoryNN.cxx +++ b/fairmq/nanomsg/FairMQTransportFactoryNN.cxx @@ -17,7 +17,7 @@ FairMQ::Transport FairMQTransportFactoryNN::fTransportType = FairMQ::Transport:: FairMQTransportFactoryNN::FairMQTransportFactoryNN(const string& id, const FairMQProgOptions* /*config*/) : FairMQTransportFactory(id) { - LOG(DEBUG) << "Transport: Using nanomsg library"; + LOG(debug) << "Transport: Using nanomsg library"; } FairMQMessagePtr FairMQTransportFactoryNN::CreateMessage() const diff --git a/fairmq/nanomsg/FairMQUnmanagedRegionNN.cxx b/fairmq/nanomsg/FairMQUnmanagedRegionNN.cxx index 2ac3362b..7f8c06d5 100644 --- a/fairmq/nanomsg/FairMQUnmanagedRegionNN.cxx +++ b/fairmq/nanomsg/FairMQUnmanagedRegionNN.cxx @@ -30,6 +30,6 @@ size_t FairMQUnmanagedRegionNN::GetSize() const FairMQUnmanagedRegionNN::~FairMQUnmanagedRegionNN() { - LOG(DEBUG) << "destroying region"; + LOG(debug) << "destroying region"; free(fBuffer); } diff --git a/fairmq/options/FairMQParser.cxx b/fairmq/options/FairMQParser.cxx index c815b211..f634510b 100644 --- a/fairmq/options/FairMQParser.cxx +++ b/fairmq/options/FairMQParser.cxx @@ -35,8 +35,8 @@ FairMQMap ptreeToMQMap(const boost::property_tree::ptree& pt, const string& id, if (channelMap.empty()) { - LOG(WARN) << "---- No channel keys found for " << id; - LOG(WARN) << "---- Check the JSON inputs and/or command line inputs"; + LOG(warn) << "---- No channel keys found for " << id; + LOG(warn) << "---- Check the JSON inputs and/or command line inputs"; } return channelMap; @@ -88,12 +88,12 @@ void PrintDeviceList(const boost::property_tree::ptree& tree, const string& form if (key != "") { deviceIdKey = key; - LOG(DEBUG) << "Found config for device key '" << deviceIdKey << "' in JSON input"; + LOG(debug) << "Found config for device key '" << deviceIdKey << "' in JSON input"; } else { deviceIdKey = q.second.get("id"); - LOG(DEBUG) << "Found config for device id '" << deviceIdKey << "' in JSON input"; + LOG(debug) << "Found config for device id '" << deviceIdKey << "' in JSON input"; } } } @@ -104,7 +104,7 @@ void PrintDeviceList(const boost::property_tree::ptree& tree, const string& form if (formatFlag == "xml") { deviceIdKey = p.second.get(".id"); - LOG(DEBUG) << "Found config for '" << deviceIdKey << "' in XML input"; + LOG(debug) << "Found config for '" << deviceIdKey << "' in XML input"; } if (formatFlag == "json") @@ -113,12 +113,12 @@ void PrintDeviceList(const boost::property_tree::ptree& tree, const string& form if (key != "") { deviceIdKey = key; - LOG(DEBUG) << "Found config for device key '" << deviceIdKey << "' in JSON input"; + LOG(debug) << "Found config for device key '" << deviceIdKey << "' in JSON input"; } else { deviceIdKey = p.second.get("id"); - LOG(DEBUG) << "Found config for device id '" << deviceIdKey << "' in JSON input"; + LOG(debug) << "Found config for device id '" << deviceIdKey << "' in JSON input"; } } } @@ -129,7 +129,7 @@ void DeviceParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap { string deviceIdKey; - LOG(DEBUG) << "Looking for '" << deviceId << "' id/key in the provided config file..."; + LOG(debug) << "Looking for '" << deviceId << "' id/key in the provided config file..."; // For each node in fairMQOptions for (const auto& p : tree) @@ -144,12 +144,12 @@ void DeviceParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap if (key != "") { deviceIdKey = key; - // LOG(DEBUG) << "Found config for device key '" << deviceIdKey << "' in JSON input"; + // LOG(debug) << "Found config for device key '" << deviceIdKey << "' in JSON input"; } else { deviceIdKey = q.second.get("id"); - // LOG(DEBUG) << "Found config for device id '" << deviceIdKey << "' in JSON input"; + // LOG(debug) << "Found config for device id '" << deviceIdKey << "' in JSON input"; } // if not correct device id, do not fill MQMap @@ -158,7 +158,7 @@ void DeviceParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap continue; } - LOG(DEBUG) << "Found with following channels:"; + LOG(debug) << "Found with following channels:"; ChannelParser(q.second, channelMap, formatFlag); } @@ -179,12 +179,12 @@ void DeviceParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap if (key != "") { deviceIdKey = key; - // LOG(DEBUG) << "Found config for device key '" << deviceIdKey << "' in JSON input"; + // LOG(debug) << "Found config for device key '" << deviceIdKey << "' in JSON input"; } else { deviceIdKey = p.second.get("id"); - // LOG(DEBUG) << "Found config for device id '" << deviceIdKey << "' in JSON input"; + // LOG(debug) << "Found config for device id '" << deviceIdKey << "' in JSON input"; } } @@ -194,7 +194,7 @@ void DeviceParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap continue; } - LOG(DEBUG) << "Found with following channels:"; + LOG(debug) << "Found with following channels:"; ChannelParser(p.second, channelMap, formatFlag); } @@ -232,19 +232,19 @@ void ChannelParser(const boost::property_tree::ptree& tree, FairMQMap& channelMa if (numSockets > 0) { - LOG(DEBUG) << "" << channelKey << ":"; - LOG(DEBUG) << "\tnumSockets of " << numSockets << " specified,"; - LOG(DEBUG) << "\tapplying common settings to each:"; + LOG(debug) << "" << channelKey << ":"; + LOG(debug) << "\tnumSockets of " << numSockets << " specified,"; + LOG(debug) << "\tapplying common settings to each:"; - LOG(DEBUG) << "\ttype = " << commonChannel.GetType(); - LOG(DEBUG) << "\tmethod = " << commonChannel.GetMethod(); - LOG(DEBUG) << "\taddress = " << commonChannel.GetAddress(); - LOG(DEBUG) << "\ttransport = " << commonChannel.GetTransport(); - LOG(DEBUG) << "\tsndBufSize = " << commonChannel.GetSndBufSize(); - LOG(DEBUG) << "\trcvBufSize = " << commonChannel.GetRcvBufSize(); - LOG(DEBUG) << "\tsndKernelSize = " << commonChannel.GetSndKernelSize(); - LOG(DEBUG) << "\trcvKernelSize = " << commonChannel.GetRcvKernelSize(); - LOG(DEBUG) << "\trateLogging = " << commonChannel.GetRateLogging(); + LOG(debug) << "\ttype = " << commonChannel.GetType(); + LOG(debug) << "\tmethod = " << commonChannel.GetMethod(); + LOG(debug) << "\taddress = " << commonChannel.GetAddress(); + LOG(debug) << "\ttransport = " << commonChannel.GetTransport(); + LOG(debug) << "\tsndBufSize = " << commonChannel.GetSndBufSize(); + LOG(debug) << "\trcvBufSize = " << commonChannel.GetRcvBufSize(); + LOG(debug) << "\tsndKernelSize = " << commonChannel.GetSndKernelSize(); + LOG(debug) << "\trcvKernelSize = " << commonChannel.GetRcvKernelSize(); + LOG(debug) << "\trateLogging = " << commonChannel.GetRateLogging(); for (int i = 0; i < numSockets; ++i) { @@ -296,19 +296,19 @@ void ChannelParser(const boost::property_tree::ptree& tree, FairMQMap& channelMa if (numSockets > 0) { - LOG(DEBUG) << "" << channelKey << ":"; - LOG(DEBUG) << "\tnumSockets of " << numSockets << " specified,"; - LOG(DEBUG) << "\tapplying common settings to each:"; + LOG(debug) << "" << channelKey << ":"; + LOG(debug) << "\tnumSockets of " << numSockets << " specified,"; + LOG(debug) << "\tapplying common settings to each:"; - LOG(DEBUG) << "\ttype = " << commonChannel.GetType(); - LOG(DEBUG) << "\tmethod = " << commonChannel.GetMethod(); - LOG(DEBUG) << "\taddress = " << commonChannel.GetAddress(); - LOG(DEBUG) << "\ttransport = " << commonChannel.GetTransport(); - LOG(DEBUG) << "\tsndBufSize = " << commonChannel.GetSndBufSize(); - LOG(DEBUG) << "\trcvBufSize = " << commonChannel.GetRcvBufSize(); - LOG(DEBUG) << "\tsndKernelSize = " << commonChannel.GetSndKernelSize(); - LOG(DEBUG) << "\trcvKernelSize = " << commonChannel.GetRcvKernelSize(); - LOG(DEBUG) << "\trateLogging = " << commonChannel.GetRateLogging(); + LOG(debug) << "\ttype = " << commonChannel.GetType(); + LOG(debug) << "\tmethod = " << commonChannel.GetMethod(); + LOG(debug) << "\taddress = " << commonChannel.GetAddress(); + LOG(debug) << "\ttransport = " << commonChannel.GetTransport(); + LOG(debug) << "\tsndBufSize = " << commonChannel.GetSndBufSize(); + LOG(debug) << "\trcvBufSize = " << commonChannel.GetRcvBufSize(); + LOG(debug) << "\tsndKernelSize = " << commonChannel.GetSndKernelSize(); + LOG(debug) << "\trcvKernelSize = " << commonChannel.GetRcvKernelSize(); + LOG(debug) << "\trateLogging = " << commonChannel.GetRateLogging(); for (int i = 0; i < numSockets; ++i) { @@ -351,16 +351,16 @@ void SocketParser(const boost::property_tree::ptree& tree, vector channel.UpdateRcvKernelSize(q.second.get("rcvKernelSize", channel.GetRcvKernelSize())); channel.UpdateRateLogging(q.second.get("rateLogging", channel.GetRateLogging())); - LOG(DEBUG) << "" << channelName << "[" << socketCounter << "]:"; - LOG(DEBUG) << "\ttype = " << channel.GetType(); - LOG(DEBUG) << "\tmethod = " << channel.GetMethod(); - LOG(DEBUG) << "\taddress = " << channel.GetAddress(); - LOG(DEBUG) << "\ttransport = " << channel.GetTransport(); - LOG(DEBUG) << "\tsndBufSize = " << channel.GetSndBufSize(); - LOG(DEBUG) << "\trcvBufSize = " << channel.GetRcvBufSize(); - LOG(DEBUG) << "\tsndKernelSize = " << channel.GetSndKernelSize(); - LOG(DEBUG) << "\trcvKernelSize = " << channel.GetRcvKernelSize(); - LOG(DEBUG) << "\trateLogging = " << channel.GetRateLogging(); + LOG(debug) << "" << channelName << "[" << socketCounter << "]:"; + LOG(debug) << "\ttype = " << channel.GetType(); + LOG(debug) << "\tmethod = " << channel.GetMethod(); + LOG(debug) << "\taddress = " << channel.GetAddress(); + LOG(debug) << "\ttransport = " << channel.GetTransport(); + LOG(debug) << "\tsndBufSize = " << channel.GetSndBufSize(); + LOG(debug) << "\trcvBufSize = " << channel.GetRcvBufSize(); + LOG(debug) << "\tsndKernelSize = " << channel.GetSndKernelSize(); + LOG(debug) << "\trcvKernelSize = " << channel.GetRcvKernelSize(); + LOG(debug) << "\trateLogging = " << channel.GetRateLogging(); channelList.push_back(channel); ++socketCounter; @@ -383,16 +383,16 @@ void SocketParser(const boost::property_tree::ptree& tree, vector channel.UpdateRcvKernelSize(p.second.get("rcvKernelSize", channel.GetRcvKernelSize())); channel.UpdateRateLogging(p.second.get("rateLogging", channel.GetRateLogging())); - LOG(DEBUG) << "" << channelName << "[" << socketCounter << "]:"; - LOG(DEBUG) << "\ttype = " << channel.GetType(); - LOG(DEBUG) << "\tmethod = " << channel.GetMethod(); - LOG(DEBUG) << "\taddress = " << channel.GetAddress(); - LOG(DEBUG) << "\ttransport = " << channel.GetTransport(); - LOG(DEBUG) << "\tsndBufSize = " << channel.GetSndBufSize(); - LOG(DEBUG) << "\trcvBufSize = " << channel.GetRcvBufSize(); - LOG(DEBUG) << "\tsndKernelSize = " << channel.GetSndKernelSize(); - LOG(DEBUG) << "\trcvKernelSize = " << channel.GetRcvKernelSize(); - LOG(DEBUG) << "\trateLogging = " << channel.GetRateLogging(); + LOG(debug) << "" << channelName << "[" << socketCounter << "]:"; + LOG(debug) << "\ttype = " << channel.GetType(); + LOG(debug) << "\tmethod = " << channel.GetMethod(); + LOG(debug) << "\taddress = " << channel.GetAddress(); + LOG(debug) << "\ttransport = " << channel.GetTransport(); + LOG(debug) << "\tsndBufSize = " << channel.GetSndBufSize(); + LOG(debug) << "\trcvBufSize = " << channel.GetRcvBufSize(); + LOG(debug) << "\tsndKernelSize = " << channel.GetSndKernelSize(); + LOG(debug) << "\trcvKernelSize = " << channel.GetRcvKernelSize(); + LOG(debug) << "\trateLogging = " << channel.GetRateLogging(); channelList.push_back(channel); ++socketCounter; @@ -401,25 +401,25 @@ void SocketParser(const boost::property_tree::ptree& tree, vector if (socketCounter) { - LOG(DEBUG) << "Found " << socketCounter << " socket(s) in channel."; + LOG(debug) << "Found " << socketCounter << " socket(s) in channel."; } else { - LOG(DEBUG) << "" << channelName << ":"; - LOG(DEBUG) << "\tNo sockets specified,"; - LOG(DEBUG) << "\tapplying common settings to the channel:"; + LOG(debug) << "" << channelName << ":"; + LOG(debug) << "\tNo sockets specified,"; + LOG(debug) << "\tapplying common settings to the channel:"; FairMQChannel channel(commonChannel); - LOG(DEBUG) << "\ttype = " << channel.GetType(); - LOG(DEBUG) << "\tmethod = " << channel.GetMethod(); - LOG(DEBUG) << "\taddress = " << channel.GetAddress(); - LOG(DEBUG) << "\ttransport = " << channel.GetTransport(); - LOG(DEBUG) << "\tsndBufSize = " << channel.GetSndBufSize(); - LOG(DEBUG) << "\trcvBufSize = " << channel.GetRcvBufSize(); - LOG(DEBUG) << "\tsndKernelSize = " << channel.GetSndKernelSize(); - LOG(DEBUG) << "\trcvKernelSize = " << channel.GetRcvKernelSize(); - LOG(DEBUG) << "\trateLogging = " << channel.GetRateLogging(); + LOG(debug) << "\ttype = " << channel.GetType(); + LOG(debug) << "\tmethod = " << channel.GetMethod(); + LOG(debug) << "\taddress = " << channel.GetAddress(); + LOG(debug) << "\ttransport = " << channel.GetTransport(); + LOG(debug) << "\tsndBufSize = " << channel.GetSndBufSize(); + LOG(debug) << "\trcvBufSize = " << channel.GetRcvBufSize(); + LOG(debug) << "\tsndKernelSize = " << channel.GetSndKernelSize(); + LOG(debug) << "\trcvKernelSize = " << channel.GetRcvKernelSize(); + LOG(debug) << "\trateLogging = " << channel.GetRateLogging(); channelList.push_back(channel); } diff --git a/fairmq/options/FairMQProgOptions.cxx b/fairmq/options/FairMQProgOptions.cxx index 131565f7..d924dde1 100644 --- a/fairmq/options/FairMQProgOptions.cxx +++ b/fairmq/options/FairMQProgOptions.cxx @@ -99,10 +99,10 @@ int FairMQProgOptions::ParseAll(const int argc, char const* const* argv, bool al if (!optionExists) { - LOG(WARN) << "FairMQProgOptions: no channels configuration provided via neither of:"; + LOG(warn) << "FairMQProgOptions: no channels configuration provided via neither of:"; for (const auto& p : MQParserKeys) { - LOG(WARNING) << " --" << p; + LOG(warn) << " --" << p; } LOG(warn) << "No channels will be created (You can create them manually)."; } @@ -122,7 +122,7 @@ int FairMQProgOptions::ParseAll(const int argc, char const* const* argv, bool al // if cmdline mq-config called then use the default xml/json parser if (fVarMap.count("mq-config")) { - LOG(DEBUG) << "mq-config: Using default XML/JSON parser"; + LOG(debug) << "mq-config: Using default XML/JSON parser"; string file = fVarMap["mq-config"].as(); @@ -149,7 +149,7 @@ int FairMQProgOptions::ParseAll(const int argc, char const* const* argv, bool al } else if (fVarMap.count("config-json-string")) { - LOG(DEBUG) << "config-json-string: Parsing JSON string"; + LOG(debug) << "config-json-string: Parsing JSON string"; string value = FairMQ::ConvertVariableValue().Run(fVarMap.at("config-json-string")); stringstream ss; @@ -158,7 +158,7 @@ int FairMQProgOptions::ParseAll(const int argc, char const* const* argv, bool al } else if (fVarMap.count("config-xml-string")) { - LOG(DEBUG) << "config-json-string: Parsing XML string"; + LOG(debug) << "config-json-string: Parsing XML string"; string value = FairMQ::ConvertVariableValue().Run(fVarMap.at("config-xml-string")); stringstream ss; @@ -167,7 +167,7 @@ int FairMQProgOptions::ParseAll(const int argc, char const* const* argv, bool al } else if (fVarMap.count(FairMQParser::SUBOPT::OptionKeyChannelConfig)) { - LOG(DEBUG) << "channel-config: Parsing channel configuration"; + LOG(debug) << "channel-config: Parsing channel configuration"; UserParser(fVarMap, id); } } @@ -325,7 +325,7 @@ int FairMQProgOptions::UpdateChannelMap(const string& channelName, int index, co else { //if we get there it means something is wrong - LOG(ERROR) << "update of FairMQChannel map failed for the following key: " + LOG(error) << "update of FairMQChannel map failed for the following key: " << channelName << "." << index << "." << member; return 1; } @@ -353,7 +353,7 @@ int FairMQProgOptions::UpdateChannelMap(const string& channelName, int index, co else { // if we get there it means something is wrong - LOG(ERROR) << "update of FairMQChannel map failed for the following key: " << channelName << "." << index << "." << member; + LOG(error) << "update of FairMQChannel map failed for the following key: " << channelName << "." << index << "." << member; return 1; } } diff --git a/fairmq/options/FairMQProgOptions.h b/fairmq/options/FairMQProgOptions.h index 55ac99a5..7edd831e 100644 --- a/fairmq/options/FairMQProgOptions.h +++ b/fairmq/options/FairMQProgOptions.h @@ -62,7 +62,7 @@ class FairMQProgOptions : public FairProgOptions } catch (std::exception& e) { - LOG(ERROR) << e.what(); + LOG(error) << e.what(); return 1; } return 0; diff --git a/fairmq/options/FairMQSuboptParser.cxx b/fairmq/options/FairMQSuboptParser.cxx index 4be8c66a..3859bff2 100644 --- a/fairmq/options/FairMQSuboptParser.cxx +++ b/fairmq/options/FairMQSuboptParser.cxx @@ -64,7 +64,7 @@ FairMQMap SUBOPT::UserParser(const po::variables_map& omap, const std::string& d else { // TODO: what is the error policy here, should we abort? - LOG(ERROR) << "missing channel name in argument of option --channel-config"; + LOG(error) << "missing channel name in argument of option --channel-config"; } } for (auto channelProperty : channelProperties) diff --git a/fairmq/options/FairProgOptions.cxx b/fairmq/options/FairProgOptions.cxx index 0e602e40..e3bec096 100644 --- a/fairmq/options/FairProgOptions.cxx +++ b/fairmq/options/FairProgOptions.cxx @@ -195,7 +195,7 @@ int FairProgOptions::PrintOptions() } ss << setfill ('*') << setw(totalLength + 3) << "*";// +3 for " = " - LOG(DEBUG) << ss.str(); + LOG(debug) << ss.str(); return 0; } diff --git a/fairmq/options/FairProgOptions.h b/fairmq/options/FairProgOptions.h index 2461fede..d5e8a1e1 100644 --- a/fairmq/options/FairProgOptions.h +++ b/fairmq/options/FairProgOptions.h @@ -98,7 +98,7 @@ class FairProgOptions } else { - LOG(ERROR) << "Config has no key: " << key; + LOG(error) << "Config has no key: " << key; } } catch (std::exception& e) @@ -125,8 +125,8 @@ class FairProgOptions } catch (std::exception& e) { - LOG(ERROR) << "Exception thrown for the key '" << key << "'"; - LOG(ERROR) << e.what(); + LOG(error) << "Exception thrown for the key '" << key << "'"; + LOG(error) << e.what(); } return valueStr; @@ -152,7 +152,7 @@ class FairProgOptions } else { - LOG(ERROR) << "the provided string " << strValue << " cannot be converted in the requested type. The target types must be arithmetic types"; + LOG(error) << "the provided string " << strValue << " cannot be converted in the requested type. The target types must be arithmetic types"; } } diff --git a/fairmq/options/ProgOptionTest/run/runOptTestSampler.cxx b/fairmq/options/ProgOptionTest/run/runOptTestSampler.cxx index 04b7c0f8..78ac18e1 100644 --- a/fairmq/options/ProgOptionTest/run/runOptTestSampler.cxx +++ b/fairmq/options/ProgOptionTest/run/runOptTestSampler.cxx @@ -68,8 +68,8 @@ int main(int argc, char** argv) } catch (exception& e) { - LOG(ERROR) << e.what(); - LOG(INFO) << "Command line options are the following : "; + LOG(error) << e.what(); + LOG(info) << "Command line options are the following : "; config.PrintHelp(); return 1; } diff --git a/fairmq/options/ProgOptionTest/run/runOptTestSink.cxx b/fairmq/options/ProgOptionTest/run/runOptTestSink.cxx index 1270f5f9..68c3fcdf 100644 --- a/fairmq/options/ProgOptionTest/run/runOptTestSink.cxx +++ b/fairmq/options/ProgOptionTest/run/runOptTestSink.cxx @@ -62,8 +62,8 @@ int main(int argc, char** argv) } catch (exception& e) { - LOG(ERROR) << e.what(); - LOG(INFO) << "Command line options are the following : "; + LOG(error) << e.what(); + LOG(info) << "Command line options are the following : "; config.PrintHelp(); return 1; } diff --git a/fairmq/options/ProgOptionTest/run/testMQoptions1.cxx b/fairmq/options/ProgOptionTest/run/testMQoptions1.cxx index 25645f3f..835d9743 100644 --- a/fairmq/options/ProgOptionTest/run/testMQoptions1.cxx +++ b/fairmq/options/ProgOptionTest/run/testMQoptions1.cxx @@ -13,7 +13,7 @@ // Parse xml from file int testXML1(FairMQProgOptions* config) { - LOG(INFO)<<"--------- test XML1 ---------\n"; + LOG(info)<<"--------- test XML1 ---------\n"; std::string filename; std::string XMLrootNode; @@ -25,14 +25,14 @@ int testXML1(FairMQProgOptions* config) config->UserParser(filename); config->UserParser(filename,"merger"); - LOG(INFO)<<"--------- test XML1 end ---------\n"; + LOG(info)<<"--------- test XML1 end ---------\n"; return 0; } // Parse xml from command line int testXML2(FairMQProgOptions* config) { - LOG(INFO)<<"--------- test XML2 ---------\n"; + LOG(info)<<"--------- test XML2 ---------\n"; std::string XML; std::string XMLrootNode; std::string id=config->GetValue("id"); @@ -45,14 +45,14 @@ int testXML2(FairMQProgOptions* config) iss << XML; config->UserParser(iss,id,XMLrootNode); - LOG(INFO)<<"--------- test XML2 end ---------\n"; + LOG(info)<<"--------- test XML2 end ---------\n"; return 0; } // Parse json from file int testJSON1(FairMQProgOptions* config) { - LOG(INFO)<<"--------- test JSON1 ---------\n"; + LOG(info)<<"--------- test JSON1 ---------\n"; std::string filename; std::string JSONrootNode; std::string id=config->GetValue("id"); @@ -62,14 +62,14 @@ int testJSON1(FairMQProgOptions* config) config->UserParser(filename,id,JSONrootNode); - LOG(INFO)<<"--------- test JSON1 end ---------\n"; + LOG(info)<<"--------- test JSON1 end ---------\n"; return 0; } // Parse json from command line int testJSON2(FairMQProgOptions* config) { - LOG(INFO)<<"--------- test JSON2 ---------\n"; + LOG(info)<<"--------- test JSON2 ---------\n"; std::string JSON; std::string JSONrootNode; std::string id=config->GetValue("id"); @@ -82,7 +82,7 @@ int testJSON2(FairMQProgOptions* config) iss << JSON; config->UserParser(iss,id,JSONrootNode); - LOG(INFO)<<"--------- test JSON2 end ---------\n"; + LOG(info)<<"--------- test JSON2 end ---------\n"; return 0; } @@ -134,7 +134,7 @@ int main(int argc, char** argv) } catch (std::exception& e) { - LOG(ERROR) << e.what(); + LOG(error) << e.what(); return 1; } return 0; diff --git a/fairmq/options/ProgOptionTest/run/testMQoptions2.cxx b/fairmq/options/ProgOptionTest/run/testMQoptions2.cxx index a6c28c15..56d30e59 100644 --- a/fairmq/options/ProgOptionTest/run/testMQoptions2.cxx +++ b/fairmq/options/ProgOptionTest/run/testMQoptions2.cxx @@ -62,7 +62,7 @@ int main(int argc, char** argv) } catch (std::exception& e) { - MQLOG(ERROR) << e.what(); + LOG(error) << e.what(); return 1; } return 0; diff --git a/fairmq/options/runConfigEx.cxx b/fairmq/options/runConfigEx.cxx index f2f73f34..36ac0b35 100644 --- a/fairmq/options/runConfigEx.cxx +++ b/fairmq/options/runConfigEx.cxx @@ -46,7 +46,7 @@ class MyDevice : public FairMQDevice void Print() { - LOG(INFO) << "[MyDevice] rate = " << fRate; + LOG(info) << "[MyDevice] rate = " << fRate; } private: @@ -96,61 +96,61 @@ int main(int argc, char** argv) // string dataRateStr = config.GetStringValue("data-rate"); // double dataRate = config.ConvertTo(dataRateStr); - // LOG(INFO) << "dataRate: " << dataRate; + // LOG(info) << "dataRate: " << dataRate; - LOG(INFO) << "Subscribing: (chans.data.0.address)"; + LOG(info) << "Subscribing: (chans.data.0.address)"; config.Subscribe("test", [&device](const string& key, string value) { if (key == "chans.data.0.address") { - LOG(INFO) << "[callback] Updating device parameter " << key << " = " << value; + LOG(info) << "[callback] Updating device parameter " << key << " = " << value; device.fChannels.at("data").at(0).UpdateAddress(value); } }); - LOG(INFO) << "Subscribing: (chans.data.0.rcvBufSize)"; + LOG(info) << "Subscribing: (chans.data.0.rcvBufSize)"; config.Subscribe("test", [&device](const string& key, int value) { if(key == "chans.data.0.rcvBufSize") { - LOG(INFO) << "[callback] Updating device parameter " << key << " = " << value; + LOG(info) << "[callback] Updating device parameter " << key << " = " << value; device.fChannels.at("data").at(0).UpdateRcvBufSize(value); } }); - LOG(INFO) << "Subscribing: (data-rate)"; + LOG(info) << "Subscribing: (data-rate)"; config.Subscribe("test", [&device](const string& key, double value) { if (key == "data-rate") { - LOG(INFO) << "[callback] Updating device parameter " << key << " = " << value; + LOG(info) << "[callback] Updating device parameter " << key << " = " << value; device.SetRate(value); } }); - LOG(INFO) << "Starting value updates...\n"; + LOG(info) << "Starting value updates...\n"; config.UpdateValue("chans.data.0.address", "tcp://localhost:4321"); - LOG(INFO) << "config: " << config.GetValue("chans.data.0.address"); - LOG(INFO) << "device: " << device.fChannels.at("data").at(0).GetAddress() << endl; + LOG(info) << "config: " << config.GetValue("chans.data.0.address"); + LOG(info) << "device: " << device.fChannels.at("data").at(0).GetAddress() << endl; config.UpdateValue("chans.data.0.rcvBufSize", 100); - LOG(INFO) << "config: " << config.GetValue("chans.data.0.rcvBufSize"); - LOG(INFO) << "device: " << device.fChannels.at("data").at(0).GetRcvBufSize() << endl; + LOG(info) << "config: " << config.GetValue("chans.data.0.rcvBufSize"); + LOG(info) << "device: " << device.fChannels.at("data").at(0).GetRcvBufSize() << endl; config.UpdateValue("data-rate", 0.9); - LOG(INFO) << "config: " << config.GetValue("data-rate"); - LOG(INFO) << "device: " << device.GetRate() << endl; + LOG(info) << "config: " << config.GetValue("data-rate"); + LOG(info) << "device: " << device.GetRate() << endl; // device.Print(); - LOG(INFO) << "nase: " << config.GetValue("nase"); + LOG(info) << "nase: " << config.GetValue("nase"); config.Unsubscribe("test"); config.Unsubscribe("test"); config.Unsubscribe("test"); // advanced commands - // LOG(INFO) << "-------------------- start custom 1"; + // LOG(info) << "-------------------- start custom 1"; // config.Connect("myNewKey", [](MyDevice& d, double val) // { @@ -160,14 +160,14 @@ int main(int argc, char** argv) // config.Emit("myNewKey", device, 0.123); - // LOG(INFO) << "-------------------- start custom 2 with function"; + // LOG(info) << "-------------------- start custom 2 with function"; // config.Connect("function example", &MyCallBack); // config.Emit("function example", device, 6.66); } catch (exception& e) { - LOG(ERROR) << "Unhandled Exception reached the top of main: " + LOG(error) << "Unhandled Exception reached the top of main: " << e.what() << ", application will now exit"; return 1; } diff --git a/fairmq/plugins/Control.cxx b/fairmq/plugins/Control.cxx index e9f8bcc1..eb7f8513 100644 --- a/fairmq/plugins/Control.cxx +++ b/fairmq/plugins/Control.cxx @@ -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("catch-signals"); + LOG(debug) << "catch-signals: " << GetProperty("catch-signals"); if (GetProperty("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(); } } diff --git a/fairmq/plugins/DDS/DDS.cxx b/fairmq/plugins/DDS/DDS.cxx index 4256247b..1896b6f0 100644 --- a/fairmq/plugins/DDS/DDS.cxx +++ b/fairmq/plugins/DDS/DDS.cxx @@ -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("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(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(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; } }); } diff --git a/fairmq/runFairMQDevice.h b/fairmq/runFairMQDevice.h index 7264ce47..f222a0ea 100644 --- a/fairmq/runFairMQDevice.h +++ b/fairmq/runFairMQDevice.h @@ -56,12 +56,12 @@ int main(int argc, char* argv[]) } catch (std::exception& e) { - LOG(ERROR) << "Unhandled exception reached the top of main: " << e.what() << ", application will now exit"; + LOG(error) << "Unhandled exception reached the top of main: " << e.what() << ", application will now exit"; return 1; } catch (...) { - LOG(ERROR) << "Non-exception instance being thrown. Please make sure you use std::runtime_exception() instead. Application will now exit."; + LOG(error) << "Non-exception instance being thrown. Please make sure you use std::runtime_exception() instead. Application will now exit."; return 1; } } diff --git a/fairmq/shmem/FairMQMessageSHM.cxx b/fairmq/shmem/FairMQMessageSHM.cxx index 60da2342..6f9cbcd9 100644 --- a/fairmq/shmem/FairMQMessageSHM.cxx +++ b/fairmq/shmem/FairMQMessageSHM.cxx @@ -39,7 +39,7 @@ FairMQMessageSHM::FairMQMessageSHM(Manager& manager) { if (zmq_msg_init(&fMessage) != 0) { - LOG(ERROR) << "failed initializing message, reason: " << zmq_strerror(errno); + LOG(error) << "failed initializing message, reason: " << zmq_strerror(errno); } fMetaCreated = true; } @@ -104,7 +104,7 @@ FairMQMessageSHM::FairMQMessageSHM(Manager& manager, FairMQUnmanagedRegionPtr& r if (zmq_msg_init_size(&fMessage, sizeof(MetaHeader)) != 0) { - LOG(ERROR) << "failed initializing meta message, reason: " << zmq_strerror(errno); + LOG(error) << "failed initializing meta message, reason: " << zmq_strerror(errno); } else { @@ -120,8 +120,8 @@ FairMQMessageSHM::FairMQMessageSHM(Manager& manager, FairMQUnmanagedRegionPtr& r } else { - LOG(ERROR) << "shmem: trying to create region message with data from outside the region"; - throw runtime_error("shmem: trying to create region message with data from outside the region"); + LOG(error) << "trying to create region message with data from outside the region"; + throw runtime_error("trying to create region message with data from outside the region"); } } @@ -137,7 +137,7 @@ bool FairMQMessageSHM::InitializeChunk(const size_t size) } catch (bipc::bad_alloc& ba) { - // LOG(WARN) << "Shared memory full..."; + // LOG(warn) << "Shared memory full..."; this_thread::sleep_for(chrono::milliseconds(50)); if (fInterrupted) { @@ -155,7 +155,7 @@ bool FairMQMessageSHM::InitializeChunk(const size_t size) if (zmq_msg_init_size(&fMessage, sizeof(MetaHeader)) != 0) { - LOG(ERROR) << "failed initializing meta message, reason: " << zmq_strerror(errno); + LOG(error) << "failed initializing meta message, reason: " << zmq_strerror(errno); return false; } MetaHeader header; @@ -178,7 +178,7 @@ void FairMQMessageSHM::Rebuild() if (zmq_msg_init(&fMessage) != 0) { - LOG(ERROR) << "failed initializing message, reason: " << zmq_strerror(errno); + LOG(error) << "failed initializing message, reason: " << zmq_strerror(errno); } fMetaCreated = true; } @@ -238,7 +238,7 @@ void* FairMQMessageSHM::GetData() const } else { - // LOG(WARN) << "could not get pointer from a region message"; + // LOG(warn) << "could not get pointer from a region message"; fLocalPtr = nullptr; } return fLocalPtr; @@ -273,13 +273,13 @@ bool FairMQMessageSHM::SetUsedSize(const size_t size) } catch (bipc::interprocess_exception& e) { - LOG(INFO) << "FairMQMessageSHM::SetUsedSize could not set used size: " << e.what(); + LOG(info) << "could not set used size: " << e.what(); return false; } } else { - LOG(ERROR) << "FairMQMessageSHM::SetUsedSize: cannot set used size higher than original."; + LOG(error) << "cannot set used size higher than original."; return false; } } @@ -303,12 +303,12 @@ void FairMQMessageSHM::Copy(const FairMQMessage& msg) } else { - LOG(ERROR) << "FairMQMessageSHM::Copy() fail: source message not initialized!"; + LOG(error) << "copy fail: source message not initialized!"; } } else { - LOG(ERROR) << "FairMQMessageSHM::Copy() fail: target message already initialized!"; + LOG(error) << "copy fail: target message already initialized!"; } } @@ -326,12 +326,12 @@ void FairMQMessageSHM::Copy(const FairMQMessagePtr& msg) } else { - LOG(ERROR) << "FairMQMessageSHM::Copy() fail: source message not initialized!"; + LOG(error) << "copy fail: source message not initialized!"; } } else { - LOG(ERROR) << "FairMQMessageSHM::Copy() fail: target message already initialized!"; + LOG(error) << "copy fail: target message already initialized!"; } } @@ -350,11 +350,11 @@ void FairMQMessageSHM::CloseMessage() // RegionBlock block(fHandle, fSize); // if (fManager.GetRegionQueue(fRegionId).try_send(static_cast(&block), sizeof(RegionBlock), 0)) // { - // // LOG(INFO) << "true"; + // // LOG(info) << "true"; // } // // else // // { - // // LOG(DEBUG) << "could not send ack"; + // // LOG(debug) << "could not send ack"; // // } // timed version @@ -379,12 +379,12 @@ void FairMQMessageSHM::CloseMessage() { break; } - LOG(DEBUG) << "region ack queue is full, retrying..."; + LOG(debug) << "region ack queue is full, retrying..."; } } else { - // LOG(WARN) << "region ack queue for id " << fRegionId << " no longer exist. Not sending ack"; + // LOG(warn) << "region ack queue for id " << fRegionId << " no longer exist. Not sending ack"; success = true; } } @@ -396,7 +396,7 @@ void FairMQMessageSHM::CloseMessage() { if (zmq_msg_close(&fMessage) != 0) { - LOG(ERROR) << "failed closing message, reason: " << zmq_strerror(errno); + LOG(error) << "failed closing message, reason: " << zmq_strerror(errno); } } } diff --git a/fairmq/shmem/FairMQPollerSHM.cxx b/fairmq/shmem/FairMQPollerSHM.cxx index a138c6b4..90edec89 100644 --- a/fairmq/shmem/FairMQPollerSHM.cxx +++ b/fairmq/shmem/FairMQPollerSHM.cxx @@ -103,8 +103,8 @@ FairMQPollerSHM::FairMQPollerSHM(const unordered_map milliseconds before terminating. @@ -50,30 +50,30 @@ FairMQSocketSHM::FairMQSocketSHM(Manager& manager, const string& type, const str int linger = 1000; if (zmq_setsockopt(fSocket, ZMQ_LINGER, &linger, sizeof(linger)) != 0) { - LOG(ERROR) << "Failed setting ZMQ_LINGER socket option, reason: " << zmq_strerror(errno); + LOG(error) << "Failed setting ZMQ_LINGER socket option, reason: " << zmq_strerror(errno); } int sndTimeout = 700; if (zmq_setsockopt(fSocket, ZMQ_SNDTIMEO, &sndTimeout, sizeof(sndTimeout)) != 0) { - LOG(ERROR) << "Failed setting ZMQ_SNDTIMEO socket option, reason: " << zmq_strerror(errno); + LOG(error) << "Failed setting ZMQ_SNDTIMEO socket option, reason: " << zmq_strerror(errno); } int rcvTimeout = 700; if (zmq_setsockopt(fSocket, ZMQ_RCVTIMEO, &rcvTimeout, sizeof(rcvTimeout)) != 0) { - LOG(ERROR) << "Failed setting ZMQ_RCVTIMEO socket option, reason: " << zmq_strerror(errno); + LOG(error) << "Failed setting ZMQ_RCVTIMEO socket option, reason: " << zmq_strerror(errno); } if (type == "sub") { if (zmq_setsockopt(fSocket, ZMQ_SUBSCRIBE, nullptr, 0) != 0) { - LOG(ERROR) << "Failed setting ZMQ_SUBSCRIBE socket option, reason: " << zmq_strerror(errno); + LOG(error) << "Failed setting ZMQ_SUBSCRIBE socket option, reason: " << zmq_strerror(errno); } } - // LOG(INFO) << "created socket " << fId; + // LOG(info) << "created socket " << fId; } string FairMQSocketSHM::GetId() @@ -83,7 +83,7 @@ string FairMQSocketSHM::GetId() bool FairMQSocketSHM::Bind(const string& address) { - // LOG(INFO) << "bind socket " << fId << " on " << address; + // LOG(info) << "bind socket " << fId << " on " << address; if (zmq_bind(fSocket, address.c_str()) != 0) { @@ -91,7 +91,7 @@ bool FairMQSocketSHM::Bind(const string& address) // do not print error in this case, this is handled by FairMQDevice in case no connection could be established after trying a number of random ports from a range. return false; } - LOG(ERROR) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno); return false; } return true; @@ -99,11 +99,11 @@ bool FairMQSocketSHM::Bind(const string& address) void FairMQSocketSHM::Connect(const string& address) { - // LOG(INFO) << "connect socket " << fId << " on " << address; + // LOG(info) << "connect socket " << fId << " on " << address; if (zmq_connect(fSocket, address.c_str()) != 0) { - LOG(ERROR) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno); // error here means incorrect configuration. exit if it happens. exit(EXIT_FAILURE); } @@ -142,12 +142,12 @@ int FairMQSocketSHM::Send(FairMQMessagePtr& msg, const int flags) } else if (zmq_errno() == ETERM) { - LOG(INFO) << "terminating socket " << fId; + LOG(info) << "terminating socket " << fId; return -1; } else { - LOG(ERROR) << "Failed sending on socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed sending on socket " << fId << ", reason: " << zmq_strerror(errno); return nbytes; } } @@ -196,12 +196,12 @@ int FairMQSocketSHM::Receive(FairMQMessagePtr& msg, const int flags) } else if (zmq_errno() == ETERM) { - LOG(INFO) << "terminating socket " << fId; + LOG(info) << "terminating socket " << fId; return -1; } else { - LOG(ERROR) << "Failed receiving on socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed receiving on socket " << fId << ", reason: " << zmq_strerror(errno); return nbytes; } } @@ -249,10 +249,10 @@ int64_t FairMQSocketSHM::Send(vector& msgVec, const int flags) } if (zmq_errno() == ETERM) { - LOG(INFO) << "terminating socket " << fId; + LOG(info) << "terminating socket " << fId; return -1; } - LOG(ERROR) << "Failed sending on socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed sending on socket " << fId << ", reason: " << zmq_strerror(errno); return nbytes; } } @@ -276,7 +276,7 @@ int64_t FairMQSocketSHM::Send(vector& msgVec, const int flags) } else // if the vector is empty, something might be wrong { - LOG(WARN) << "Will not send empty vector"; + LOG(warn) << "Will not send empty vector"; return -1; } } @@ -292,7 +292,7 @@ int64_t FairMQSocketSHM::Receive(vector& msgVec, const int fla // Warn if the vector is filled before Receive() and empty it. // if (msgVec.size() > 0) // { - // LOG(WARN) << "Message vector contains elements before Receive(), they will be deleted!"; + // LOG(warn) << "Message vector contains elements before Receive(), they will be deleted!"; // msgVec.clear(); // } @@ -360,7 +360,7 @@ int64_t FairMQSocketSHM::Receive(vector& msgVec, const int fla void FairMQSocketSHM::Close() { - // LOG(DEBUG) << "Closing socket " << fId; + // LOG(debug) << "Closing socket " << fId; if (fSocket == nullptr) { @@ -369,7 +369,7 @@ void FairMQSocketSHM::Close() if (zmq_close(fSocket) != 0) { - LOG(ERROR) << "Failed closing socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed closing socket " << fId << ", reason: " << zmq_strerror(errno); } fSocket = nullptr; @@ -404,7 +404,7 @@ void FairMQSocketSHM::SetOption(const string& option, const void* value, size_t { if (zmq_setsockopt(fSocket, GetConstant(option), value, valueSize) < 0) { - LOG(ERROR) << "Failed setting socket option, reason: " << zmq_strerror(errno); + LOG(error) << "Failed setting socket option, reason: " << zmq_strerror(errno); } } @@ -412,7 +412,7 @@ void FairMQSocketSHM::GetOption(const string& option, void* value, size_t* value { if (zmq_getsockopt(fSocket, GetConstant(option), value, valueSize) < 0) { - LOG(ERROR) << "Failed getting socket option, reason: " << zmq_strerror(errno); + LOG(error) << "Failed getting socket option, reason: " << zmq_strerror(errno); } } @@ -442,17 +442,17 @@ bool FairMQSocketSHM::SetSendTimeout(const int timeout, const string& address, c { if (zmq_unbind(fSocket, address.c_str()) != 0) { - LOG(ERROR) << "Failed unbinding socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed unbinding socket " << fId << ", reason: " << zmq_strerror(errno); return false; } if (zmq_setsockopt(fSocket, ZMQ_SNDTIMEO, &timeout, sizeof(int)) != 0) { - LOG(ERROR) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno); return false; } if (zmq_bind(fSocket, address.c_str()) != 0) { - LOG(ERROR) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno); return false; } } @@ -460,23 +460,23 @@ bool FairMQSocketSHM::SetSendTimeout(const int timeout, const string& address, c { if (zmq_disconnect(fSocket, address.c_str()) != 0) { - LOG(ERROR) << "Failed disconnecting socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed disconnecting socket " << fId << ", reason: " << zmq_strerror(errno); return false; } if (zmq_setsockopt(fSocket, ZMQ_SNDTIMEO, &timeout, sizeof(int)) != 0) { - LOG(ERROR) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno); return false; } if (zmq_connect(fSocket, address.c_str()) != 0) { - LOG(ERROR) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno); return false; } } else { - LOG(ERROR) << "SetSendTimeout() failed - unknown method provided!"; + LOG(error) << "timeout failed - unknown method provided!"; return false; } @@ -490,7 +490,7 @@ int FairMQSocketSHM::GetSendTimeout() const if (zmq_getsockopt(fSocket, ZMQ_SNDTIMEO, &timeout, &size) != 0) { - LOG(ERROR) << "Failed getting option 'receive timeout' on socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed getting option 'receive timeout' on socket " << fId << ", reason: " << zmq_strerror(errno); } return timeout; @@ -502,17 +502,17 @@ bool FairMQSocketSHM::SetReceiveTimeout(const int timeout, const string& address { if (zmq_unbind(fSocket, address.c_str()) != 0) { - LOG(ERROR) << "Failed unbinding socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed unbinding socket " << fId << ", reason: " << zmq_strerror(errno); return false; } if (zmq_setsockopt(fSocket, ZMQ_RCVTIMEO, &timeout, sizeof(int)) != 0) { - LOG(ERROR) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno); return false; } if (zmq_bind(fSocket, address.c_str()) != 0) { - LOG(ERROR) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno); return false; } } @@ -520,23 +520,23 @@ bool FairMQSocketSHM::SetReceiveTimeout(const int timeout, const string& address { if (zmq_disconnect(fSocket, address.c_str()) != 0) { - LOG(ERROR) << "Failed disconnecting socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed disconnecting socket " << fId << ", reason: " << zmq_strerror(errno); return false; } if (zmq_setsockopt(fSocket, ZMQ_RCVTIMEO, &timeout, sizeof(int)) != 0) { - LOG(ERROR) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno); return false; } if (zmq_connect(fSocket, address.c_str()) != 0) { - LOG(ERROR) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno); return false; } } else { - LOG(ERROR) << "SetReceiveTimeout() failed - unknown method provided!"; + LOG(error) << "timeout failed - unknown method provided!"; return false; } @@ -550,7 +550,7 @@ int FairMQSocketSHM::GetReceiveTimeout() const if (zmq_getsockopt(fSocket, ZMQ_RCVTIMEO, &timeout, &size) != 0) { - LOG(ERROR) << "Failed getting option 'receive timeout' on socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed getting option 'receive timeout' on socket " << fId << ", reason: " << zmq_strerror(errno); } return timeout; diff --git a/fairmq/shmem/FairMQTransportFactorySHM.cxx b/fairmq/shmem/FairMQTransportFactorySHM.cxx index acfcb1b8..e0dfd6bc 100644 --- a/fairmq/shmem/FairMQTransportFactorySHM.cxx +++ b/fairmq/shmem/FairMQTransportFactorySHM.cxx @@ -46,13 +46,13 @@ FairMQTransportFactorySHM::FairMQTransportFactorySHM(const string& id, const Fai { int major, minor, patch; zmq_version(&major, &minor, &patch); - LOG(DEBUG) << "Transport: Using ZeroMQ (" << major << "." << minor << "." << patch << ") & " + LOG(debug) << "Transport: Using ZeroMQ (" << major << "." << minor << "." << patch << ") & " << "boost::interprocess (" << (BOOST_VERSION / 100000) << "." << (BOOST_VERSION / 100 % 1000) << "." << (BOOST_VERSION % 100) << ")"; fContext = zmq_ctx_new(); if (!fContext) { - LOG(ERROR) << "failed creating context, reason: " << zmq_strerror(errno); + LOG(error) << "failed creating context, reason: " << zmq_strerror(errno); exit(EXIT_FAILURE); } @@ -68,7 +68,7 @@ FairMQTransportFactorySHM::FairMQTransportFactorySHM(const string& id, const Fai } else { - LOG(WARN) << "shmem: FairMQProgOptions not available! Using defaults."; + LOG(warn) << "FairMQProgOptions not available! Using defaults."; } try @@ -77,17 +77,17 @@ FairMQTransportFactorySHM::FairMQTransportFactorySHM(const string& id, const Fai if (zmq_ctx_set(fContext, ZMQ_IO_THREADS, numIoThreads) != 0) { - LOG(ERROR) << "shmem: failed configuring context, reason: " << zmq_strerror(errno); + LOG(error) << "failed configuring context, reason: " << zmq_strerror(errno); } // Set the maximum number of allowed sockets on the context. if (zmq_ctx_set(fContext, ZMQ_MAX_SOCKETS, 10000) != 0) { - LOG(ERROR) << "shmem: failed configuring context, reason: " << zmq_strerror(errno); + LOG(error) << "failed configuring context, reason: " << zmq_strerror(errno); } fManager = fair::mq::tools::make_unique(fSessionName, segmentSize); - LOG(DEBUG) << "shmem: created/opened shared memory segment '" << "fmq_shm_" << fSessionName << "_main" << "' of " << segmentSize << " bytes. Available are " << fManager->Segment().get_free_memory() << " bytes."; + LOG(debug) << "created/opened shared memory segment '" << "fmq_shm_" << fSessionName << "_main" << "' of " << segmentSize << " bytes. Available are " << fManager->Segment().get_free_memory() << " bytes."; { bipc::scoped_lock lock(*fShMutex); @@ -95,15 +95,15 @@ FairMQTransportFactorySHM::FairMQTransportFactorySHM(const string& id, const Fai fDeviceCounter = fManager->Segment().find(bipc::unique_instance).first; if (fDeviceCounter) { - LOG(DEBUG) << "shmem: device counter found, with value of " << fDeviceCounter->fCount << ". incrementing."; + LOG(debug) << "device counter found, with value of " << fDeviceCounter->fCount << ". incrementing."; (fDeviceCounter->fCount)++; - LOG(DEBUG) << "shmem: incremented device counter, now: " << fDeviceCounter->fCount; + LOG(debug) << "incremented device counter, now: " << fDeviceCounter->fCount; } else { - LOG(DEBUG) << "shmem: no device counter found, creating one and initializing with 1"; + LOG(debug) << "no device counter found, creating one and initializing with 1"; fDeviceCounter = fManager->Segment().construct(bipc::unique_instance)(1); - LOG(DEBUG) << "shmem: initialized device counter with: " << fDeviceCounter->fCount; + LOG(debug) << "initialized device counter with: " << fDeviceCounter->fCount; } // start shm monitor @@ -112,24 +112,24 @@ FairMQTransportFactorySHM::FairMQTransportFactorySHM(const string& id, const Fai // MonitorStatus* monitorStatus = fManagementSegment.find(bipc::unique_instance).first; // if (monitorStatus == nullptr) // { - // LOG(DEBUG) << "shmem: no shmmonitor found, starting..."; + // LOG(debug) << "no shmmonitor found, starting..."; // StartMonitor(); // } // else // { - // LOG(DEBUG) << "shmem: found shmmonitor."; + // LOG(debug) << "found shmmonitor."; // } // } // catch (std::exception& e) // { - // LOG(ERROR) << "shmem: Exception during shmmonitor initialization: " << e.what() << ", application will now exit"; + // LOG(error) << "Exception during shmmonitor initialization: " << e.what() << ", application will now exit"; // exit(EXIT_FAILURE); // } } } catch(bipc::interprocess_exception& e) { - LOG(ERROR) << "Could not initialize shared memory transport: " << e.what(); + LOG(error) << "Could not initialize shared memory transport: " << e.what(); throw runtime_error("Cannot update configuration. Socket method (bind/connect) not specified."); } @@ -143,20 +143,20 @@ void FairMQTransportFactorySHM::StartMonitor() if (!bfs::exists(bfs::path("shmmonitor"))) { - LOG(ERROR) << "Could not find shmmonitor. Is it in the PATH? Monitor not started"; + LOG(error) << "Could not find shmmonitor. Is it in the PATH? Monitor not started"; return; } // TODO: replace with Boost.Process once boost 1.64 is available int r = system("shmmonitor --self-destruct &"); - LOG(DEBUG) << r; + LOG(debug) << r; do { MonitorStatus* monitorStatus = fManager->ManagementSegment().find(bipc::unique_instance).first; if (monitorStatus) { - LOG(DEBUG) << "shmem: shmmonitor started"; + LOG(debug) << "shmmonitor started"; break; } else @@ -164,7 +164,7 @@ void FairMQTransportFactorySHM::StartMonitor() this_thread::sleep_for(std::chrono::milliseconds(10)); if (++numTries > 100) { - LOG(ERROR) << "Did not get response from shmmonitor after " << 10 * 100 << " milliseconds. Exiting."; + LOG(error) << "Did not get response from shmmonitor after " << 10 * 100 << " milliseconds. Exiting."; exit(EXIT_FAILURE); } } @@ -188,13 +188,13 @@ void FairMQTransportFactorySHM::SendHeartbeats() } else { - LOG(DEBUG) << "control queue timeout"; + LOG(debug) << "control queue timeout"; } } catch (bipc::interprocess_exception& ie) { this_thread::sleep_for(chrono::milliseconds(500)); - // LOG(WARN) << "no " << controlQueueName << " found"; + // LOG(warn) << "no " << controlQueueName << " found"; } } } @@ -261,7 +261,7 @@ FairMQTransportFactorySHM::~FairMQTransportFactorySHM() { if (errno == EINTR) { - LOG(ERROR) << "shmem: failed closing context, reason: " << zmq_strerror(errno); + LOG(error) << "failed closing context, reason: " << zmq_strerror(errno); } else { @@ -272,7 +272,7 @@ FairMQTransportFactorySHM::~FairMQTransportFactorySHM() } else { - LOG(ERROR) << "shmem: Terminate(): context not available for shutdown"; + LOG(error) << "context not available for shutdown"; } bool lastRemoved = false; @@ -284,14 +284,14 @@ FairMQTransportFactorySHM::~FairMQTransportFactorySHM() if (fDeviceCounter->fCount == 0) { - LOG(DEBUG) << "shmem: last segment user, removing segment."; + LOG(debug) << "last segment user, removing segment."; fManager->RemoveSegment(); lastRemoved = true; } else { - LOG(DEBUG) << "shmem: other segment users present (" << fDeviceCounter->fCount << "), not removing it."; + LOG(debug) << "other segment users present (" << fDeviceCounter->fCount << "), not removing it."; } } diff --git a/fairmq/shmem/FairMQUnmanagedRegionSHM.cxx b/fairmq/shmem/FairMQUnmanagedRegionSHM.cxx index ab43ef94..791f281b 100644 --- a/fairmq/shmem/FairMQUnmanagedRegionSHM.cxx +++ b/fairmq/shmem/FairMQUnmanagedRegionSHM.cxx @@ -25,15 +25,15 @@ FairMQUnmanagedRegionSHM::FairMQUnmanagedRegionSHM(Manager& manager, const size_ RegionCounter* rc = fManager.ManagementSegment().find(bipc::unique_instance).first; if (rc) { - LOG(DEBUG) << "shmem: region counter found, with value of " << rc->fCount << ". incrementing."; + LOG(debug) << "region counter found, with value of " << rc->fCount << ". incrementing."; (rc->fCount)++; - LOG(DEBUG) << "shmem: incremented region counter, now: " << rc->fCount; + LOG(debug) << "incremented region counter, now: " << rc->fCount; } else { - LOG(DEBUG) << "shmem: no region counter found, creating one and initializing with 1"; + LOG(debug) << "no region counter found, creating one and initializing with 1"; rc = fManager.ManagementSegment().construct(bipc::unique_instance)(1); - LOG(DEBUG) << "shmem: initialized region counter with: " << rc->fCount; + LOG(debug) << "initialized region counter with: " << rc->fCount; } fRegionId = rc->fCount; @@ -42,8 +42,8 @@ FairMQUnmanagedRegionSHM::FairMQUnmanagedRegionSHM(Manager& manager, const size_ } catch (bipc::interprocess_exception& e) { - LOG(ERROR) << "shmem: cannot create region. Already created/not cleaned up?"; - LOG(ERROR) << e.what(); + LOG(error) << "cannot create region. Already created/not cleaned up?"; + LOG(error) << e.what(); exit(EXIT_FAILURE); } } diff --git a/fairmq/shmem/Manager.cxx b/fairmq/shmem/Manager.cxx index 3ba5a25d..fdc70ea6 100644 --- a/fairmq/shmem/Manager.cxx +++ b/fairmq/shmem/Manager.cxx @@ -58,7 +58,7 @@ bipc::mapped_region* Manager::CreateRegion(const size_t size, const uint64_t id, auto it = fRegions.find(id); if (it != fRegions.end()) { - LOG(ERROR) << "shmem: Trying to create a region that already exists"; + LOG(error) << "Trying to create a region that already exists"; return nullptr; } else @@ -88,7 +88,7 @@ Region* Manager::GetRemoteRegion(const uint64_t id) } catch (bipc::interprocess_exception& e) { - // LOG(WARN) << "remote region (" << id << ") no longer exists"; + // LOG(warn) << "remote region (" << id << ") no longer exists"; return nullptr; } @@ -104,20 +104,20 @@ void Manager::RemoveSegment() { if (bipc::shared_memory_object::remove(fSegmentName.c_str())) { - LOG(DEBUG) << "shmem: successfully removed " << fSegmentName << " segment after the device has stopped."; + LOG(debug) << "successfully removed " << fSegmentName << " segment after the device has stopped."; } else { - LOG(DEBUG) << "shmem: did not remove " << fSegmentName << " segment after the device stopped. Already removed?"; + LOG(debug) << "did not remove " << fSegmentName << " segment after the device stopped. Already removed?"; } if (bipc::shared_memory_object::remove(fManagementSegmentName.c_str())) { - LOG(DEBUG) << "shmem: successfully removed '" << fManagementSegmentName << "' segment after the device has stopped."; + LOG(debug) << "successfully removed '" << fManagementSegmentName << "' segment after the device has stopped."; } else { - LOG(DEBUG) << "shmem: did not remove '" << fManagementSegmentName << "' segment after the device stopped. Already removed?"; + LOG(debug) << "did not remove '" << fManagementSegmentName << "' segment after the device stopped. Already removed?"; } } diff --git a/fairmq/shmem/Region.cxx b/fairmq/shmem/Region.cxx index beefe3f4..3c2bb0e1 100644 --- a/fairmq/shmem/Region.cxx +++ b/fairmq/shmem/Region.cxx @@ -38,19 +38,19 @@ Region::Region(Manager& manager, uint64_t id, uint64_t size, bool remote, FairMQ if (fRemote) { fShmemObject = bipc::shared_memory_object(bipc::open_only, fName.c_str(), bipc::read_write); - LOG(DEBUG) << "shmem: located remote region: " << fName; + LOG(debug) << "shmem: located remote region: " << fName; fQueue = fair::mq::tools::make_unique(bipc::open_only, fQueueName.c_str()); - LOG(DEBUG) << "shmem: located remote region queue: " << fQueueName; + LOG(debug) << "shmem: located remote region queue: " << fQueueName; } else { fShmemObject = bipc::shared_memory_object(bipc::create_only, fName.c_str(), bipc::read_write); - LOG(DEBUG) << "shmem: created region: " << fName; + LOG(debug) << "shmem: created region: " << fName; fShmemObject.truncate(size); fQueue = fair::mq::tools::make_unique(bipc::create_only, fQueueName.c_str(), 10000, sizeof(RegionBlock)); - LOG(DEBUG) << "shmem: created region queue: " << fQueueName; + LOG(debug) << "shmem: created region queue: " << fQueueName; } fRegion = bipc::mapped_region(fShmemObject, bipc::read_write); // TODO: add HUGEPAGES flag here // fRegion = bipc::mapped_region(fShmemObject, bipc::read_write, 0, 0, 0, MAP_HUGETLB | MAP_HUGE_1GB); @@ -72,7 +72,7 @@ void Region::ReceiveAcks() RegionBlock block; if (fQueue->timed_receive(&block, sizeof(RegionBlock), recvdSize, priority, rcvTill)) { - // LOG(DEBUG) << "received: " << block.fHandle << " " << block.fSize << " " << block.fMessageId; + // LOG(debug) << "received: " << block.fHandle << " " << block.fSize << " " << block.fMessageId; if (fCallback) { fCallback(reinterpret_cast(fRegion.get_address()) + block.fHandle, block.fSize, reinterpret_cast(block.fHint)); @@ -80,11 +80,11 @@ void Region::ReceiveAcks() } else { - // LOG(DEBUG) << "queue " << fQueueName << " timeout!"; + // LOG(debug) << "queue " << fQueueName << " timeout!"; } } // while !fStop - LOG(DEBUG) << "worker for " << fName << " leaving."; + LOG(debug) << "worker for " << fName << " leaving."; } Region::~Region() @@ -99,18 +99,18 @@ Region::~Region() if (bipc::shared_memory_object::remove(fName.c_str())) { - LOG(DEBUG) << "shmem: destroyed region " << fName; + LOG(debug) << "shmem: destroyed region " << fName; } if (bipc::message_queue::remove(fQueueName.c_str())) { - LOG(DEBUG) << "shmem: removed region queue " << fName; + LOG(debug) << "shmem: removed region queue " << fName; } } else { - // LOG(DEBUG) << "shmem: region '" << fName << "' is remote, no cleanup necessary."; - LOG(DEBUG) << "shmem: region queue '" << fQueueName << "' is remote, no cleanup necessary"; + // LOG(debug) << "shmem: region '" << fName << "' is remote, no cleanup necessary."; + LOG(debug) << "shmem: region queue '" << fQueueName << "' is remote, no cleanup necessary"; } } diff --git a/fairmq/shmem/prototype/FairMQShmPrototypeSampler.cxx b/fairmq/shmem/prototype/FairMQShmPrototypeSampler.cxx index 10d75505..ebfb1400 100644 --- a/fairmq/shmem/prototype/FairMQShmPrototypeSampler.cxx +++ b/fairmq/shmem/prototype/FairMQShmPrototypeSampler.cxx @@ -40,11 +40,11 @@ FairMQShmPrototypeSampler::FairMQShmPrototypeSampler() { if (shared_memory_object::remove("FairMQSharedMemoryPrototype")) { - LOG(INFO) << "Successfully removed shared memory upon device start."; + LOG(info) << "Successfully removed shared memory upon device start."; } else { - LOG(INFO) << "Did not remove shared memory upon device start."; + LOG(info) << "Did not remove shared memory upon device start."; } } @@ -52,11 +52,11 @@ FairMQShmPrototypeSampler::~FairMQShmPrototypeSampler() { if (shared_memory_object::remove("FairMQSharedMemoryPrototype")) { - LOG(INFO) << "Successfully removed shared memory after the device has stopped."; + LOG(info) << "Successfully removed shared memory after the device has stopped."; } else { - LOG(INFO) << "Did not remove shared memory after the device stopped. Still in use?"; + LOG(info) << "Did not remove shared memory after the device stopped. Still in use?"; } } @@ -66,7 +66,7 @@ void FairMQShmPrototypeSampler::Init() fMsgRate = fConfig->GetValue("msg-rate"); SegmentManager::Instance().InitializeSegment("open_or_create", "FairMQSharedMemoryPrototype", 2000000000); - LOG(INFO) << "Created/Opened shared memory segment of 2,000,000,000 bytes. Available are " + LOG(info) << "Created/Opened shared memory segment of 2,000,000,000 bytes. Available are " << SegmentManager::Instance().Segment()->get_free_memory() << " bytes."; } @@ -75,7 +75,7 @@ void FairMQShmPrototypeSampler::Run() // count sent messages (also used in creating ShmChunk container ID) static uint64_t numSentMsgs = 0; - LOG(INFO) << "Starting the benchmark with message size of " << fMsgSize; + LOG(info) << "Starting the benchmark with message size of " << fMsgSize; // start rate logger and acknowledgement listener in separate threads thread rateLogger(&FairMQShmPrototypeSampler::Log, this, 1000); @@ -123,7 +123,7 @@ void FairMQShmPrototypeSampler::Run() // } // catch (bipc::bad_alloc& ba) // { - // LOG(WARN) << "Shared memory full..."; + // LOG(warn) << "Shared memory full..."; // this_thread::sleep_for(chrono::milliseconds(100)); // continue; // } @@ -139,12 +139,12 @@ void FairMQShmPrototypeSampler::Run() // charnum = 97; // } - // LOG(DEBUG) << "chunk handle: " << owner->fPtr->GetHandle(); - // LOG(DEBUG) << "chunk size: " << owner->fPtr->GetSize(); - // LOG(DEBUG) << "owner (" << ownerID << ") use count: " << owner->fPtr.use_count(); + // LOG(debug) << "chunk handle: " << owner->fPtr->GetHandle(); + // LOG(debug) << "chunk size: " << owner->fPtr->GetSize(); + // LOG(debug) << "owner (" << ownerID << ") use count: " << owner->fPtr.use_count(); // char* cptr = static_cast(ptr); - // LOG(DEBUG) << "check: " << cptr[3]; + // LOG(debug) << "check: " << cptr[3]; // FairMQMessagePtr msg(NewSimpleMessage(ownerID)); @@ -156,9 +156,9 @@ void FairMQShmPrototypeSampler::Run() metaPtr->fSize = fMsgSize; metaPtr->fHandle = handle; - // LOG(INFO) << metaPtr->fSize; - // LOG(INFO) << metaPtr->fHandle; - // LOG(WARN) << ptr; + // LOG(info) << metaPtr->fSize; + // LOG(info) << metaPtr->fHandle; + // LOG(warn) << ptr; if (Send(msg, "meta", 0) > 0) { @@ -180,7 +180,7 @@ void FairMQShmPrototypeSampler::Run() // } } - LOG(INFO) << "Sent " << numSentMsgs << " messages, leaving RUNNING state."; + LOG(info) << "Sent " << numSentMsgs << " messages, leaving RUNNING state."; rateLogger.join(); // resetMsgCounter.join(); @@ -207,7 +207,7 @@ void FairMQShmPrototypeSampler::Log(const int intervalInMs) msgPerSecOut = static_cast(fMsgOutNew - fMsgOut) / static_cast(msSinceLastLog) * 1000.; fMsgOut = fMsgOutNew; - LOG(DEBUG) << fixed + LOG(debug) << fixed << setprecision(0) << "out: " << msgPerSecOut << " msg (" << setprecision(2) << mbPerSecOut << " MB)\t(" << SegmentManager::Instance().Segment()->get_free_memory() / (1024. * 1024.) << " MB free)"; diff --git a/fairmq/shmem/prototype/FairMQShmPrototypeSink.cxx b/fairmq/shmem/prototype/FairMQShmPrototypeSink.cxx index 86fa2922..941f1f7b 100644 --- a/fairmq/shmem/prototype/FairMQShmPrototypeSink.cxx +++ b/fairmq/shmem/prototype/FairMQShmPrototypeSink.cxx @@ -44,7 +44,7 @@ FairMQShmPrototypeSink::~FairMQShmPrototypeSink() void FairMQShmPrototypeSink::Init() { SegmentManager::Instance().InitializeSegment("open_or_create", "FairMQSharedMemoryPrototype", 2000000000); - LOG(INFO) << "Created/Opened shared memory segment of 2,000,000,000 bytes. Available are " + LOG(info) << "Created/Opened shared memory segment of 2,000,000,000 bytes. Available are " << SegmentManager::Instance().Segment()->get_free_memory() << " bytes."; } @@ -65,9 +65,9 @@ void FairMQShmPrototypeSink::Run() bipc::managed_shared_memory::handle_t handle = hdr->fHandle; void* ptr = SegmentManager::Instance().Segment()->get_address_from_handle(handle); - // LOG(INFO) << size; - // LOG(INFO) << handle; - // LOG(WARN) << ptr; + // LOG(info) << size; + // LOG(info) << handle; + // LOG(warn) << ptr; fBytesInNew += size; ++fMsgInNew; @@ -78,21 +78,21 @@ void FairMQShmPrototypeSink::Run() // find the shared pointer in shared memory with its ID // ShPtrOwner* owner = SegmentManager::Instance().Segment()->find(ownerID.c_str()).first; - // LOG(DEBUG) << "owner (" << ownerID << ") use count: " << owner->fPtr.use_count(); + // LOG(debug) << "owner (" << ownerID << ") use count: " << owner->fPtr.use_count(); // if (owner) // { // // void* ptr = owner->fPtr->GetData(); - // // LOG(DEBUG) << "chunk handle: " << owner->fPtr->GetHandle(); - // // LOG(DEBUG) << "chunk size: " << owner->fPtr->GetSize(); + // // LOG(debug) << "chunk handle: " << owner->fPtr->GetHandle(); + // // LOG(debug) << "chunk size: " << owner->fPtr->GetSize(); // fBytesInNew += owner->fPtr->GetSize(); // ++fMsgInNew; // // char* cptr = static_cast(ptr); - // // LOG(DEBUG) << "check: " << cptr[3]; + // // LOG(debug) << "check: " << cptr[3]; // SegmentManager::Instance().Segment()->deallocate(ptr); @@ -100,7 +100,7 @@ void FairMQShmPrototypeSink::Run() // } // else // { - // LOG(WARN) << "Shared pointer is zero."; + // LOG(warn) << "Shared pointer is zero."; // } @@ -108,7 +108,7 @@ void FairMQShmPrototypeSink::Run() } } - LOG(INFO) << "Received " << numReceivedMsgs << " messages, leaving RUNNING state."; + LOG(info) << "Received " << numReceivedMsgs << " messages, leaving RUNNING state."; rateLogger.join(); } @@ -134,7 +134,7 @@ void FairMQShmPrototypeSink::Log(const int intervalInMs) msgPerSecIn = static_cast(fMsgInNew - fMsgIn) / static_cast(msSinceLastLog) * 1000.; fMsgIn = fMsgInNew; - LOG(DEBUG) << fixed + LOG(debug) << fixed << setprecision(0) << "in: " << msgPerSecIn << " msg (" << setprecision(2) << mbPerSecIn << " MB)\t(" << SegmentManager::Instance().Segment()->get_free_memory() / (1024. * 1024.) << " MB free)"; diff --git a/fairmq/shmem/prototype/ShmChunk.h b/fairmq/shmem/prototype/ShmChunk.h index 91276581..79f25872 100644 --- a/fairmq/shmem/prototype/ShmChunk.h +++ b/fairmq/shmem/prototype/ShmChunk.h @@ -64,13 +64,13 @@ class SegmentManager { if (++numTries == 5) { - LOG(ERROR) << "Could not open shared memory after " << numTries << " attempts, exiting!"; + LOG(error) << "Could not open shared memory after " << numTries << " attempts, exiting!"; exit(EXIT_FAILURE); } else { - LOG(DEBUG) << "Could not open shared memory segment on try " << numTries << ". Retrying in 1 second..."; - LOG(DEBUG) << ie.what(); + LOG(debug) << "Could not open shared memory segment on try " << numTries << ". Retrying in 1 second..."; + LOG(debug) << ie.what(); std::this_thread::sleep_for(std::chrono::milliseconds(1000)); } @@ -80,18 +80,18 @@ class SegmentManager } else { - LOG(ERROR) << "Unknown operation when initializing shared memory segment: " << op; + LOG(error) << "Unknown operation when initializing shared memory segment: " << op; } } catch (std::exception& e) { - LOG(ERROR) << "Exception during shared memory segment initialization: " << e.what() << ", application will now exit"; + LOG(error) << "Exception during shared memory segment initialization: " << e.what() << ", application will now exit"; exit(EXIT_FAILURE); } } else { - LOG(INFO) << "Segment already initialized"; + LOG(info) << "Segment already initialized"; } } @@ -103,7 +103,7 @@ class SegmentManager } else { - LOG(ERROR) << "Segment not initialized"; + LOG(error) << "Segment not initialized"; exit(EXIT_FAILURE); } } diff --git a/fairmq/test/device/TestReceiver.h b/fairmq/test/device/TestReceiver.h index a00eabd5..41b15de1 100644 --- a/fairmq/test/device/TestReceiver.h +++ b/fairmq/test/device/TestReceiver.h @@ -44,11 +44,11 @@ class Receiver : public FairMQDevice auto msg = FairMQMessagePtr{NewMessage()}; if (Receive(msg, fChannelName) >= 0) { - LOG(INFO) << "received empty message"; + LOG(info) << "received empty message"; } else { - LOG(ERROR) << "fair::mq::test::Receiver::Run(): Receive(msg, fChannelName) < 0"; + LOG(error) << "fair::mq::test::Receiver::Run(): Receive(msg, fChannelName) < 0"; } }; diff --git a/fairmq/test/device/TestSender.h b/fairmq/test/device/TestSender.h index d1ca44b3..cea43c23 100644 --- a/fairmq/test/device/TestSender.h +++ b/fairmq/test/device/TestSender.h @@ -44,11 +44,11 @@ class Sender : public FairMQDevice auto msg = FairMQMessagePtr{NewMessage()}; if (Send(msg, fChannelName) >= 0) { - LOG(INFO) << "sent empty message"; + LOG(info) << "sent empty message"; } else { - LOG(ERROR) << "fair::mq::test::Sender::Run(): Send(msg, fChannelName) < 0"; + LOG(error) << "fair::mq::test::Sender::Run(): Send(msg, fChannelName) < 0"; } }; diff --git a/fairmq/test/helper/devices/TestPollIn.cxx b/fairmq/test/helper/devices/TestPollIn.cxx index f4880c33..9aa70caa 100644 --- a/fairmq/test/helper/devices/TestPollIn.cxx +++ b/fairmq/test/helper/devices/TestPollIn.cxx @@ -61,7 +61,7 @@ class PollIn : public FairMQDevice } else { - LOG(ERROR) << "wrong poll type provided: " << fPollType; + LOG(error) << "wrong poll type provided: " << fPollType; } bool arrived1 = false; @@ -79,7 +79,7 @@ class PollIn : public FairMQDevice { if (poller->CheckInput(0)) { - LOG(DEBUG) << "CheckInput(0) triggered"; + LOG(debug) << "CheckInput(0) triggered"; if (Receive(msg1, "data1", 0) >= 0) { arrived1 = true; @@ -88,7 +88,7 @@ class PollIn : public FairMQDevice if (poller->CheckInput(1)) { - LOG(DEBUG) << "CheckInput(1) triggered"; + LOG(debug) << "CheckInput(1) triggered"; if (Receive(msg2, "data2", 0) >= 0) { arrived2 = true; @@ -99,7 +99,7 @@ class PollIn : public FairMQDevice { if (poller->CheckInput("data1", 0)) { - LOG(DEBUG) << "CheckInput(\"data1\", 0) triggered"; + LOG(debug) << "CheckInput(\"data1\", 0) triggered"; if (Receive(msg1, "data1", 0) >= 0) { arrived1 = true; @@ -108,7 +108,7 @@ class PollIn : public FairMQDevice if (poller->CheckInput("data2", 0)) { - LOG(DEBUG) << "CheckInput(\"data2\", 0) triggered"; + LOG(debug) << "CheckInput(\"data2\", 0) triggered"; if (Receive(msg2, "data2", 0) >= 0) { arrived2 = true; @@ -119,7 +119,7 @@ class PollIn : public FairMQDevice if (arrived1 && arrived2) { bothArrived = true; - LOG(INFO) << "POLL test successfull"; + LOG(info) << "POLL test successfull"; } } }; diff --git a/fairmq/test/helper/devices/TestPub.cxx b/fairmq/test/helper/devices/TestPub.cxx index 796eee56..cf82da98 100644 --- a/fairmq/test/helper/devices/TestPub.cxx +++ b/fairmq/test/helper/devices/TestPub.cxx @@ -39,17 +39,17 @@ class Pub : public FairMQDevice auto r2 = Receive(ready2, "control"); if (r1 >= 0 && r2 >= 0) { - LOG(INFO) << "Received both ready signals, proceeding to publish data"; + LOG(info) << "Received both ready signals, proceeding to publish data"; auto msg = FairMQMessagePtr{NewMessage()}; auto d1 = Send(msg, "data"); if (d1 >= 0) { - LOG(INFO) << "Sent data: d1 = " << d1; + LOG(info) << "Sent data: d1 = " << d1; } else { - LOG(ERROR) << "Failed sending data: d1 = " << d1; + LOG(error) << "Failed sending data: d1 = " << d1; } auto ack1 = FairMQMessagePtr{NewMessage()}; @@ -58,16 +58,16 @@ class Pub : public FairMQDevice auto a2 = Receive(ack2, "control"); if (a1 >= 0 && a2 >= 0) { - LOG(INFO) << "PUB-SUB test successfull"; + LOG(info) << "PUB-SUB test successfull"; } else { - LOG(ERROR) << "Failed receiving ack signal: a1 = " << a1 << ", a2 = " << a2; + LOG(error) << "Failed receiving ack signal: a1 = " << a1 << ", a2 = " << a2; } } else { - LOG(ERROR) << "Failed receiving ready signal: r1 = " << r1 << ", r2 = " << r2; + LOG(error) << "Failed receiving ready signal: r1 = " << r1 << ", r2 = " << r2; } } }; diff --git a/fairmq/test/helper/devices/TestPull.cxx b/fairmq/test/helper/devices/TestPull.cxx index c7d7ad7b..007f7de4 100644 --- a/fairmq/test/helper/devices/TestPull.cxx +++ b/fairmq/test/helper/devices/TestPull.cxx @@ -37,7 +37,7 @@ class Pull : public FairMQDevice if (Receive(msg, "data") >= 0) { - LOG(INFO) << "PUSH-PULL test successfull"; + LOG(info) << "PUSH-PULL test successfull"; } }; }; diff --git a/fairmq/test/helper/devices/TestRep.cxx b/fairmq/test/helper/devices/TestRep.cxx index 850533f1..5bb2879a 100644 --- a/fairmq/test/helper/devices/TestRep.cxx +++ b/fairmq/test/helper/devices/TestRep.cxx @@ -34,19 +34,19 @@ class Rep : public FairMQDevice auto request1 = FairMQMessagePtr{NewMessage()}; if (Receive(request1, "data") >= 0) { - LOG(INFO) << "Received request 1"; + LOG(info) << "Received request 1"; auto reply = FairMQMessagePtr{NewMessage()}; Send(reply, "data"); } auto request2 = FairMQMessagePtr{NewMessage()}; if (Receive(request2, "data") >= 0) { - LOG(INFO) << "Received request 2"; + LOG(info) << "Received request 2"; auto reply = FairMQMessagePtr{NewMessage()}; Send(reply, "data"); } - LOG(INFO) << "REQ-REP test successfull"; + LOG(info) << "REQ-REP test successfull"; }; }; diff --git a/fairmq/test/helper/devices/TestReq.cxx b/fairmq/test/helper/devices/TestReq.cxx index f507183a..396597c5 100644 --- a/fairmq/test/helper/devices/TestReq.cxx +++ b/fairmq/test/helper/devices/TestReq.cxx @@ -37,7 +37,7 @@ class Req : public FairMQDevice auto reply = FairMQMessagePtr{NewMessage()}; if (Receive(reply, "data") >= 0) { - LOG(INFO) << "received reply"; + LOG(info) << "received reply"; } }; }; diff --git a/fairmq/test/helper/devices/TestSub.cxx b/fairmq/test/helper/devices/TestSub.cxx index 56e25238..81a5fd3e 100644 --- a/fairmq/test/helper/devices/TestSub.cxx +++ b/fairmq/test/helper/devices/TestSub.cxx @@ -37,31 +37,31 @@ class Sub : public FairMQDevice auto r1 = Send(ready, "control"); if (r1 >= 0) { - LOG(INFO) << "Sent first control signal"; + LOG(info) << "Sent first control signal"; auto msg = FairMQMessagePtr{NewMessage()}; auto d1 = Receive(msg, "data"); if (d1 >= 0) { - LOG(INFO) << "Received data"; + LOG(info) << "Received data"; auto ack = FairMQMessagePtr{NewMessage()}; auto a1 = Send(ack, "control"); if (a1 >= 0) { - LOG(INFO) << "Sent second control signal"; + LOG(info) << "Sent second control signal"; } else { - LOG(ERROR) << "Failed sending ack signal: a1 = " << a1; + LOG(error) << "Failed sending ack signal: a1 = " << a1; } } else { - LOG(ERROR) << "Failed receiving data: d1 = " << d1; + LOG(error) << "Failed receiving data: d1 = " << d1; } } else { - LOG(ERROR) << "Failed sending ready signal: r1 = " << r1; + LOG(error) << "Failed sending ready signal: r1 = " << r1; } } }; diff --git a/fairmq/test/helper/devices/TestTransferTimeout.cxx b/fairmq/test/helper/devices/TestTransferTimeout.cxx index 3b767d4a..a644b6d5 100644 --- a/fairmq/test/helper/devices/TestTransferTimeout.cxx +++ b/fairmq/test/helper/devices/TestTransferTimeout.cxx @@ -29,27 +29,27 @@ class TransferTimeout : public FairMQDevice if (Send(msg1, "data-out", 0, 100) == -2) { - LOG(INFO) << "send canceled"; + LOG(info) << "send canceled"; sendCanceling = true; } else { - LOG(ERROR) << "send did not cancel"; + LOG(error) << "send did not cancel"; } if (Receive(msg2, "data-in", 0, 100) == -2) { - LOG(INFO) << "receive canceled"; + LOG(info) << "receive canceled"; receiveCanceling = true; } else { - LOG(ERROR) << "receive did not cancel"; + LOG(error) << "receive did not cancel"; } if (sendCanceling && receiveCanceling) { - LOG(INFO) << "Transfer timeout test successfull"; + LOG(info) << "Transfer timeout test successfull"; } }; }; diff --git a/fairmq/tools/Network.h b/fairmq/tools/Network.h index ff33ae9a..4d35f297 100644 --- a/fairmq/tools/Network.h +++ b/fairmq/tools/Network.h @@ -83,7 +83,7 @@ inline std::string getInterfaceIP(std::string interface) } else { - LOG(ERROR) << "Could not find provided network interface: \"" << interface << "\"!, exiting."; + LOG(error) << "Could not find provided network interface: \"" << interface << "\"!, exiting."; return ""; } } @@ -102,7 +102,7 @@ inline std::string getDefaultRouteNetworkInterface() if (!file) { - LOG(ERROR) << "Could not detect default route network interface name - popen() failed!"; + LOG(error) << "Could not detect default route network interface name - popen() failed!"; return ""; } @@ -118,11 +118,11 @@ inline std::string getDefaultRouteNetworkInterface() if (interfaceName == "") { - LOG(ERROR) << "Could not detect default route network interface name"; + LOG(error) << "Could not detect default route network interface name"; } else { - LOG(DEBUG) << "Detected network interface name for the default route: " << interfaceName; + LOG(debug) << "Detected network interface name for the default route: " << interfaceName; } return interfaceName; diff --git a/fairmq/zeromq/FairMQMessageZMQ.cxx b/fairmq/zeromq/FairMQMessageZMQ.cxx index 9e2ce663..7ac0619d 100644 --- a/fairmq/zeromq/FairMQMessageZMQ.cxx +++ b/fairmq/zeromq/FairMQMessageZMQ.cxx @@ -30,7 +30,7 @@ FairMQMessageZMQ::FairMQMessageZMQ() { if (zmq_msg_init(fMsg.get()) != 0) { - LOG(ERROR) << "failed initializing message, reason: " << zmq_strerror(errno); + LOG(error) << "failed initializing message, reason: " << zmq_strerror(errno); } } @@ -42,7 +42,7 @@ FairMQMessageZMQ::FairMQMessageZMQ(const size_t size) { if (zmq_msg_init_size(fMsg.get(), size) != 0) { - LOG(ERROR) << "failed initializing message with size, reason: " << zmq_strerror(errno); + LOG(error) << "failed initializing message with size, reason: " << zmq_strerror(errno); } } @@ -54,7 +54,7 @@ FairMQMessageZMQ::FairMQMessageZMQ(void* data, const size_t size, fairmq_free_fn { if (zmq_msg_init_data(fMsg.get(), data, size, ffn, hint) != 0) { - LOG(ERROR) << "failed initializing message with data, reason: " << zmq_strerror(errno); + LOG(error) << "failed initializing message with data, reason: " << zmq_strerror(errno); } } @@ -69,7 +69,7 @@ FairMQMessageZMQ::FairMQMessageZMQ(FairMQUnmanagedRegionPtr& region, void* data, // Needs lifetime extension for the ZMQ region. if (zmq_msg_init_size(fMsg.get(), size) != 0) { - LOG(ERROR) << "failed initializing message with size, reason: " << zmq_strerror(errno); + LOG(error) << "failed initializing message with size, reason: " << zmq_strerror(errno); } memcpy(zmq_msg_data(fMsg.get()), data, size); @@ -78,7 +78,7 @@ FairMQMessageZMQ::FairMQMessageZMQ(FairMQUnmanagedRegionPtr& region, void* data, // if (zmq_msg_init_data(fMsg.get(), data, size, [](void*, void*){}, nullptr) != 0) // { - // LOG(ERROR) << "failed initializing message with data, reason: " << zmq_strerror(errno); + // LOG(error) << "failed initializing message with data, reason: " << zmq_strerror(errno); // } } @@ -88,7 +88,7 @@ void FairMQMessageZMQ::Rebuild() fMsg = fair::mq::tools::make_unique(); if (zmq_msg_init(fMsg.get()) != 0) { - LOG(ERROR) << "failed initializing message, reason: " << zmq_strerror(errno); + LOG(error) << "failed initializing message, reason: " << zmq_strerror(errno); } } @@ -98,7 +98,7 @@ void FairMQMessageZMQ::Rebuild(const size_t size) fMsg = fair::mq::tools::make_unique(); if (zmq_msg_init_size(fMsg.get(), size) != 0) { - LOG(ERROR) << "failed initializing message with size, reason: " << zmq_strerror(errno); + LOG(error) << "failed initializing message with size, reason: " << zmq_strerror(errno); } } @@ -108,7 +108,7 @@ void FairMQMessageZMQ::Rebuild(void* data, const size_t size, fairmq_free_fn* ff fMsg = fair::mq::tools::make_unique(); if (zmq_msg_init_data(fMsg.get(), data, size, ffn, hint) != 0) { - LOG(ERROR) << "failed initializing message with data, reason: " << zmq_strerror(errno); + LOG(error) << "failed initializing message with data, reason: " << zmq_strerror(errno); } } @@ -162,7 +162,7 @@ bool FairMQMessageZMQ::SetUsedSize(const size_t size) } else { - LOG(ERROR) << "FairMQMessageZMQ::SetUsedSize: cannot set used size higher than original."; + LOG(error) << "cannot set used size higher than original."; return false; } } @@ -185,7 +185,7 @@ void FairMQMessageZMQ::ApplyUsedSize() }, fMsg.release()) != 0) { - LOG(ERROR) << "failed initializing view message, reason: " << zmq_strerror(errno); + LOG(error) << "failed initializing view message, reason: " << zmq_strerror(errno); } } } @@ -201,7 +201,7 @@ void FairMQMessageZMQ::Copy(const FairMQMessage& msg) // Shares the message buffer between msg and this fMsg. if (zmq_msg_copy(fMsg.get(), zMsg.GetMessage()) != 0) { - LOG(ERROR) << "failed copying message, reason: " << zmq_strerror(errno); + LOG(error) << "failed copying message, reason: " << zmq_strerror(errno); return; } @@ -219,7 +219,7 @@ void FairMQMessageZMQ::Copy(const FairMQMessagePtr& msg) // Shares the message buffer between msg and this fMsg. if (zmq_msg_copy(fMsg.get(), msgPtr->GetMessage()) != 0) { - LOG(ERROR) << "failed copying message, reason: " << zmq_strerror(errno); + LOG(error) << "failed copying message, reason: " << zmq_strerror(errno); return; } @@ -237,7 +237,7 @@ void FairMQMessageZMQ::CloseMessage() { if (zmq_msg_close(fMsg.get()) != 0) { - LOG(ERROR) << "failed closing message, reason: " << zmq_strerror(errno); + LOG(error) << "failed closing message, reason: " << zmq_strerror(errno); } // reset the message object to allow reuse in Rebuild fMsg.reset(nullptr); @@ -246,7 +246,7 @@ void FairMQMessageZMQ::CloseMessage() { if (zmq_msg_close(fViewMsg.get()) != 0) { - LOG(ERROR) << "failed closing message, reason: " << zmq_strerror(errno); + LOG(error) << "failed closing message, reason: " << zmq_strerror(errno); } // reset the message object to allow reuse in Rebuild fViewMsg.reset(nullptr); diff --git a/fairmq/zeromq/FairMQPollerZMQ.cxx b/fairmq/zeromq/FairMQPollerZMQ.cxx index 5230282b..c34b9ca6 100644 --- a/fairmq/zeromq/FairMQPollerZMQ.cxx +++ b/fairmq/zeromq/FairMQPollerZMQ.cxx @@ -104,8 +104,8 @@ FairMQPollerZMQ::FairMQPollerZMQ(const unordered_map milliseconds before terminating. @@ -52,30 +52,30 @@ FairMQSocketZMQ::FairMQSocketZMQ(const string& type, const string& name, const s int linger = 1000; if (zmq_setsockopt(fSocket, ZMQ_LINGER, &linger, sizeof(linger)) != 0) { - LOG(ERROR) << "Failed setting ZMQ_LINGER socket option, reason: " << zmq_strerror(errno); + LOG(error) << "Failed setting ZMQ_LINGER socket option, reason: " << zmq_strerror(errno); } int sndTimeout = 700; if (zmq_setsockopt(fSocket, ZMQ_SNDTIMEO, &sndTimeout, sizeof(sndTimeout)) != 0) { - LOG(ERROR) << "Failed setting ZMQ_SNDTIMEO socket option, reason: " << zmq_strerror(errno); + LOG(error) << "Failed setting ZMQ_SNDTIMEO socket option, reason: " << zmq_strerror(errno); } int rcvTimeout = 700; if (zmq_setsockopt(fSocket, ZMQ_RCVTIMEO, &rcvTimeout, sizeof(rcvTimeout)) != 0) { - LOG(ERROR) << "Failed setting ZMQ_RCVTIMEO socket option, reason: " << zmq_strerror(errno); + LOG(error) << "Failed setting ZMQ_RCVTIMEO socket option, reason: " << zmq_strerror(errno); } if (type == "sub") { if (zmq_setsockopt(fSocket, ZMQ_SUBSCRIBE, nullptr, 0) != 0) { - LOG(ERROR) << "Failed setting ZMQ_SUBSCRIBE socket option, reason: " << zmq_strerror(errno); + LOG(error) << "Failed setting ZMQ_SUBSCRIBE socket option, reason: " << zmq_strerror(errno); } } - // LOG(INFO) << "created socket " << fId; + // LOG(info) << "created socket " << fId; } string FairMQSocketZMQ::GetId() @@ -85,7 +85,7 @@ string FairMQSocketZMQ::GetId() bool FairMQSocketZMQ::Bind(const string& address) { - // LOG(INFO) << "bind socket " << fId << " on " << address; + // LOG(info) << "bind socket " << fId << " on " << address; if (zmq_bind(fSocket, address.c_str()) != 0) { @@ -93,7 +93,7 @@ bool FairMQSocketZMQ::Bind(const string& address) // do not print error in this case, this is handled by FairMQDevice in case no connection could be established after trying a number of random ports from a range. return false; } - LOG(ERROR) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno); return false; } return true; @@ -101,11 +101,11 @@ bool FairMQSocketZMQ::Bind(const string& address) void FairMQSocketZMQ::Connect(const string& address) { - // LOG(INFO) << "connect socket " << fId << " on " << address; + // LOG(info) << "connect socket " << fId << " on " << address; if (zmq_connect(fSocket, address.c_str()) != 0) { - LOG(ERROR) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno); // error here means incorrect configuration. exit if it happens. exit(EXIT_FAILURE); } @@ -140,12 +140,12 @@ int FairMQSocketZMQ::Send(FairMQMessagePtr& msg, const int flags) } else if (zmq_errno() == ETERM) { - LOG(INFO) << "terminating socket " << fId; + LOG(info) << "terminating socket " << fId; return -1; } else { - LOG(ERROR) << "Failed sending on socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed sending on socket " << fId << ", reason: " << zmq_strerror(errno); return nbytes; } } @@ -177,12 +177,12 @@ int FairMQSocketZMQ::Receive(FairMQMessagePtr& msg, const int flags) } else if (zmq_errno() == ETERM) { - LOG(INFO) << "terminating socket " << fId; + LOG(info) << "terminating socket " << fId; return -1; } else { - LOG(ERROR) << "Failed receiving on socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed receiving on socket " << fId << ", reason: " << zmq_strerror(errno); return nbytes; } } @@ -233,10 +233,10 @@ int64_t FairMQSocketZMQ::Send(vector& msgVec, const int flags) } if (zmq_errno() == ETERM) { - LOG(INFO) << "terminating socket " << fId; + LOG(info) << "terminating socket " << fId; return -1; } - LOG(ERROR) << "Failed sending on socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed sending on socket " << fId << ", reason: " << zmq_strerror(errno); return nbytes; } } @@ -258,7 +258,7 @@ int64_t FairMQSocketZMQ::Send(vector& msgVec, const int flags) } else // if the vector is empty, something might be wrong { - LOG(WARN) << "Will not send empty vector"; + LOG(warn) << "Will not send empty vector"; return -1; } } @@ -321,7 +321,7 @@ int64_t FairMQSocketZMQ::Receive(vector& msgVec, const int fla void FairMQSocketZMQ::Close() { - // LOG(DEBUG) << "Closing socket " << fId; + // LOG(debug) << "Closing socket " << fId; if (fSocket == nullptr) { @@ -330,7 +330,7 @@ void FairMQSocketZMQ::Close() if (zmq_close(fSocket) != 0) { - LOG(ERROR) << "Failed closing socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed closing socket " << fId << ", reason: " << zmq_strerror(errno); } fSocket = nullptr; @@ -361,7 +361,7 @@ void FairMQSocketZMQ::SetOption(const string& option, const void* value, size_t { if (zmq_setsockopt(fSocket, GetConstant(option), value, valueSize) < 0) { - LOG(ERROR) << "Failed setting socket option, reason: " << zmq_strerror(errno); + LOG(error) << "Failed setting socket option, reason: " << zmq_strerror(errno); } } @@ -369,7 +369,7 @@ void FairMQSocketZMQ::GetOption(const string& option, void* value, size_t* value { if (zmq_getsockopt(fSocket, GetConstant(option), value, valueSize) < 0) { - LOG(ERROR) << "Failed getting socket option, reason: " << zmq_strerror(errno); + LOG(error) << "Failed getting socket option, reason: " << zmq_strerror(errno); } } @@ -399,17 +399,17 @@ bool FairMQSocketZMQ::SetSendTimeout(const int timeout, const string& address, c { if (zmq_unbind(fSocket, address.c_str()) != 0) { - LOG(ERROR) << "Failed unbinding socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed unbinding socket " << fId << ", reason: " << zmq_strerror(errno); return false; } if (zmq_setsockopt(fSocket, ZMQ_SNDTIMEO, &timeout, sizeof(int)) != 0) { - LOG(ERROR) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno); return false; } if (zmq_bind(fSocket, address.c_str()) != 0) { - LOG(ERROR) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno); return false; } } @@ -417,23 +417,23 @@ bool FairMQSocketZMQ::SetSendTimeout(const int timeout, const string& address, c { if (zmq_disconnect(fSocket, address.c_str()) != 0) { - LOG(ERROR) << "Failed disconnecting socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed disconnecting socket " << fId << ", reason: " << zmq_strerror(errno); return false; } if (zmq_setsockopt(fSocket, ZMQ_SNDTIMEO, &timeout, sizeof(int)) != 0) { - LOG(ERROR) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno); return false; } if (zmq_connect(fSocket, address.c_str()) != 0) { - LOG(ERROR) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno); return false; } } else { - LOG(ERROR) << "SetSendTimeout() failed - unknown method provided!"; + LOG(error) << "timeout failed - unknown method provided!"; return false; } @@ -447,7 +447,7 @@ int FairMQSocketZMQ::GetSendTimeout() const if (zmq_getsockopt(fSocket, ZMQ_SNDTIMEO, &timeout, &size) != 0) { - LOG(ERROR) << "Failed getting option 'receive timeout' on socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed getting option 'receive timeout' on socket " << fId << ", reason: " << zmq_strerror(errno); } return timeout; @@ -459,17 +459,17 @@ bool FairMQSocketZMQ::SetReceiveTimeout(const int timeout, const string& address { if (zmq_unbind(fSocket, address.c_str()) != 0) { - LOG(ERROR) << "Failed unbinding socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed unbinding socket " << fId << ", reason: " << zmq_strerror(errno); return false; } if (zmq_setsockopt(fSocket, ZMQ_RCVTIMEO, &timeout, sizeof(int)) != 0) { - LOG(ERROR) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno); return false; } if (zmq_bind(fSocket, address.c_str()) != 0) { - LOG(ERROR) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno); return false; } } @@ -477,23 +477,23 @@ bool FairMQSocketZMQ::SetReceiveTimeout(const int timeout, const string& address { if (zmq_disconnect(fSocket, address.c_str()) != 0) { - LOG(ERROR) << "Failed disconnecting socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed disconnecting socket " << fId << ", reason: " << zmq_strerror(errno); return false; } if (zmq_setsockopt(fSocket, ZMQ_RCVTIMEO, &timeout, sizeof(int)) != 0) { - LOG(ERROR) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno); return false; } if (zmq_connect(fSocket, address.c_str()) != 0) { - LOG(ERROR) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno); return false; } } else { - LOG(ERROR) << "SetReceiveTimeout() failed - unknown method provided!"; + LOG(error) << "timeout failed - unknown method provided!"; return false; } @@ -507,7 +507,7 @@ int FairMQSocketZMQ::GetReceiveTimeout() const if (zmq_getsockopt(fSocket, ZMQ_RCVTIMEO, &timeout, &size) != 0) { - LOG(ERROR) << "Failed getting option 'receive timeout' on socket " << fId << ", reason: " << zmq_strerror(errno); + LOG(error) << "Failed getting option 'receive timeout' on socket " << fId << ", reason: " << zmq_strerror(errno); } return timeout; diff --git a/fairmq/zeromq/FairMQTransportFactoryZMQ.cxx b/fairmq/zeromq/FairMQTransportFactoryZMQ.cxx index b8acf407..74cef85f 100644 --- a/fairmq/zeromq/FairMQTransportFactoryZMQ.cxx +++ b/fairmq/zeromq/FairMQTransportFactoryZMQ.cxx @@ -19,17 +19,17 @@ FairMQTransportFactoryZMQ::FairMQTransportFactoryZMQ(const string& id, const Fai { int major, minor, patch; zmq_version(&major, &minor, &patch); - LOG(DEBUG) << "Transport: Using ZeroMQ library, version: " << major << "." << minor << "." << patch; + LOG(debug) << "Transport: Using ZeroMQ library, version: " << major << "." << minor << "." << patch; if (!fContext) { - LOG(ERROR) << "failed creating context, reason: " << zmq_strerror(errno); + LOG(error) << "failed creating context, reason: " << zmq_strerror(errno); exit(EXIT_FAILURE); } if (zmq_ctx_set(fContext, ZMQ_MAX_SOCKETS, 10000) != 0) { - LOG(ERROR) << "failed configuring context, reason: " << zmq_strerror(errno); + LOG(error) << "failed configuring context, reason: " << zmq_strerror(errno); } int numIoThreads = 1; @@ -39,12 +39,12 @@ FairMQTransportFactoryZMQ::FairMQTransportFactoryZMQ(const string& id, const Fai } else { - LOG(WARN) << "zeromq: FairMQProgOptions not available! Using defaults."; + LOG(warn) << "FairMQProgOptions not available! Using defaults."; } if (zmq_ctx_set(fContext, ZMQ_IO_THREADS, numIoThreads) != 0) { - LOG(ERROR) << "failed configuring context, reason: " << zmq_strerror(errno); + LOG(error) << "failed configuring context, reason: " << zmq_strerror(errno); } } @@ -113,7 +113,7 @@ FairMQTransportFactoryZMQ::~FairMQTransportFactoryZMQ() { if (errno == EINTR) { - LOG(ERROR) << " failed closing context, reason: " << zmq_strerror(errno); + LOG(error) << " failed closing context, reason: " << zmq_strerror(errno); } else { @@ -124,6 +124,6 @@ FairMQTransportFactoryZMQ::~FairMQTransportFactoryZMQ() } else { - LOG(ERROR) << "Terminate(): context not available for shutdown"; + LOG(error) << "context not available for shutdown"; } } diff --git a/fairmq/zeromq/FairMQUnmanagedRegionZMQ.cxx b/fairmq/zeromq/FairMQUnmanagedRegionZMQ.cxx index 0ad3f476..7b7e4188 100644 --- a/fairmq/zeromq/FairMQUnmanagedRegionZMQ.cxx +++ b/fairmq/zeromq/FairMQUnmanagedRegionZMQ.cxx @@ -30,6 +30,6 @@ size_t FairMQUnmanagedRegionZMQ::GetSize() const FairMQUnmanagedRegionZMQ::~FairMQUnmanagedRegionZMQ() { - LOG(DEBUG) << "destroying region"; + LOG(debug) << "destroying region"; free(fBuffer); }