convert log severities use to lowercase and remove use of MQLOG

This commit is contained in:
Alexey Rybalchenko 2017-12-22 10:40:50 +01:00 committed by Mohammad Al-Turany
parent 4e942e489b
commit a3393e600e
58 changed files with 607 additions and 609 deletions

View File

@ -52,7 +52,7 @@ auto DeviceRunner::Run() -> int
if (!fDevice) if (!fDevice)
{ {
LOG(ERROR) << "getDevice(): no valid device provided. Exiting."; LOG(error) << "getDevice(): no valid device provided. Exiting.";
return 1; return 1;
} }
@ -74,7 +74,7 @@ auto DeviceRunner::Run() -> int
return 0; return 0;
} }
LOG(DEBUG) << "PID: " << getpid(); LOG(debug) << "PID: " << getpid();
// Configure device // Configure device
fDevice->SetConfig(fConfig); fDevice->SetConfig(fConfig);
@ -99,12 +99,12 @@ auto DeviceRunner::RunWithExceptionHandlers() -> int
} }
catch (std::exception& e) 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; return 1;
} }
catch (...) 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; return 1;
} }
} }

View File

@ -183,7 +183,7 @@ string FairMQChannel::GetType() const
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::GetType: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::GetType: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -197,7 +197,7 @@ string FairMQChannel::GetMethod() const
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::GetMethod: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::GetMethod: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -211,7 +211,7 @@ string FairMQChannel::GetAddress() const
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::GetAddress: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::GetAddress: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -225,7 +225,7 @@ string FairMQChannel::GetTransport() const
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::GetTransport: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::GetTransport: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -239,7 +239,7 @@ int FairMQChannel::GetSndBufSize() const
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::GetSndBufSize: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::GetSndBufSize: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -253,7 +253,7 @@ int FairMQChannel::GetRcvBufSize() const
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::GetRcvBufSize: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::GetRcvBufSize: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -267,7 +267,7 @@ int FairMQChannel::GetSndKernelSize() const
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::GetSndKernelSize: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::GetSndKernelSize: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -281,7 +281,7 @@ int FairMQChannel::GetRcvKernelSize() const
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::GetRcvKernelSize: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::GetRcvKernelSize: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -295,7 +295,7 @@ int FairMQChannel::GetRateLogging() const
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::GetRateLogging: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::GetRateLogging: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -311,7 +311,7 @@ void FairMQChannel::UpdateType(const string& type)
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::UpdateType: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::UpdateType: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -327,7 +327,7 @@ void FairMQChannel::UpdateMethod(const string& method)
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::UpdateMethod: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::UpdateMethod: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -343,7 +343,7 @@ void FairMQChannel::UpdateAddress(const string& address)
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::UpdateAddress: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::UpdateAddress: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -359,7 +359,7 @@ void FairMQChannel::UpdateTransport(const string& transport)
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::UpdateTransport: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::UpdateTransport: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -375,7 +375,7 @@ void FairMQChannel::UpdateSndBufSize(const int sndBufSize)
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::UpdateSndBufSize: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::UpdateSndBufSize: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -391,7 +391,7 @@ void FairMQChannel::UpdateRcvBufSize(const int rcvBufSize)
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::UpdateRcvBufSize: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::UpdateRcvBufSize: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -407,7 +407,7 @@ void FairMQChannel::UpdateSndKernelSize(const int sndKernelSize)
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::UpdateSndKernelSize: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::UpdateSndKernelSize: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -423,7 +423,7 @@ void FairMQChannel::UpdateRcvKernelSize(const int rcvKernelSize)
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::UpdateRcvKernelSize: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::UpdateRcvKernelSize: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -439,7 +439,7 @@ void FairMQChannel::UpdateRateLogging(const int rateLogging)
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::UpdateRateLogging: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::UpdateRateLogging: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -453,7 +453,7 @@ auto FairMQChannel::SetModified(const bool modified) -> void
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::SetModified: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::SetModified: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -469,7 +469,7 @@ void FairMQChannel::UpdateChannelName(const string& name)
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::UpdateChannelName: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::UpdateChannelName: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -483,7 +483,7 @@ bool FairMQChannel::IsValid() const
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::IsValid: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::IsValid: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -500,7 +500,7 @@ bool FairMQChannel::ValidateChannel()
if (fIsValid) if (fIsValid)
{ {
ss << "ALREADY VALID"; ss << "ALREADY VALID";
LOG(DEBUG) << ss.str(); LOG(debug) << ss.str();
return true; return true;
} }
@ -510,8 +510,8 @@ bool FairMQChannel::ValidateChannel()
if (socketTypes.find(fType) == socketTypes.end()) if (socketTypes.find(fType) == socketTypes.end())
{ {
ss << "INVALID"; ss << "INVALID";
LOG(DEBUG) << ss.str(); LOG(debug) << ss.str();
LOG(ERROR) << "Invalid channel type: \"" << fType << "\""; LOG(error) << "Invalid channel type: \"" << fType << "\"";
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -519,8 +519,8 @@ bool FairMQChannel::ValidateChannel()
if (fAddress == "unspecified" || fAddress == "") if (fAddress == "unspecified" || fAddress == "")
{ {
ss << "INVALID"; ss << "INVALID";
LOG(DEBUG) << ss.str(); LOG(debug) << ss.str();
LOG(DEBUG) << "invalid channel address: \"" << fAddress << "\""; LOG(debug) << "invalid channel address: \"" << fAddress << "\"";
return false; return false;
} }
else else
@ -542,8 +542,8 @@ bool FairMQChannel::ValidateChannel()
if (socketMethods.find(fMethod) == socketMethods.end()) if (socketMethods.find(fMethod) == socketMethods.end())
{ {
ss << "INVALID"; ss << "INVALID";
LOG(DEBUG) << ss.str(); LOG(debug) << ss.str();
LOG(ERROR) << "Invalid endpoint connection method: \"" << fMethod << "\" for " << endpoint; LOG(error) << "Invalid endpoint connection method: \"" << fMethod << "\" for " << endpoint;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
address = endpoint; address = endpoint;
@ -556,8 +556,8 @@ bool FairMQChannel::ValidateChannel()
if (addressString.find(":") == string::npos) if (addressString.find(":") == string::npos)
{ {
ss << "INVALID"; ss << "INVALID";
LOG(DEBUG) << ss.str(); LOG(debug) << ss.str();
LOG(ERROR) << "invalid channel address: \"" << address << "\" (missing port?)"; LOG(error) << "invalid channel address: \"" << address << "\" (missing port?)";
return false; return false;
} }
} }
@ -568,8 +568,8 @@ bool FairMQChannel::ValidateChannel()
if (addressString == "") if (addressString == "")
{ {
ss << "INVALID"; ss << "INVALID";
LOG(DEBUG) << ss.str(); LOG(debug) << ss.str();
LOG(ERROR) << "invalid channel address: \"" << address << "\" (empty IPC address?)"; LOG(error) << "invalid channel address: \"" << address << "\" (empty IPC address?)";
return false; return false;
} }
} }
@ -580,8 +580,8 @@ bool FairMQChannel::ValidateChannel()
if (addressString == "") if (addressString == "")
{ {
ss << "INVALID"; ss << "INVALID";
LOG(DEBUG) << ss.str(); LOG(debug) << ss.str();
LOG(ERROR) << "invalid channel address: \"" << address << "\" (empty inproc address?)"; LOG(error) << "invalid channel address: \"" << address << "\" (empty inproc address?)";
return false; return false;
} }
} }
@ -589,8 +589,8 @@ bool FairMQChannel::ValidateChannel()
{ {
// if neither TCP or IPC is specified, return invalid // if neither TCP or IPC is specified, return invalid
ss << "INVALID"; ss << "INVALID";
LOG(DEBUG) << ss.str(); LOG(debug) << ss.str();
LOG(ERROR) << "invalid channel address: \"" << address << "\" (missing protocol specifier?)"; LOG(error) << "invalid channel address: \"" << address << "\" (missing protocol specifier?)";
return false; return false;
} }
} }
@ -602,8 +602,8 @@ bool FairMQChannel::ValidateChannel()
if (FairMQ::TransportTypes.find(fTransport) == FairMQ::TransportTypes.end()) if (FairMQ::TransportTypes.find(fTransport) == FairMQ::TransportTypes.end())
{ {
ss << "INVALID"; ss << "INVALID";
LOG(DEBUG) << ss.str(); LOG(debug) << ss.str();
LOG(ERROR) << "Invalid channel transport: \"" << fTransport << "\""; LOG(error) << "Invalid channel transport: \"" << fTransport << "\"";
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -611,8 +611,8 @@ bool FairMQChannel::ValidateChannel()
if (fSndBufSize < 0) if (fSndBufSize < 0)
{ {
ss << "INVALID"; ss << "INVALID";
LOG(DEBUG) << ss.str(); LOG(debug) << ss.str();
LOG(ERROR) << "invalid channel send buffer size (cannot be negative): \"" << fSndBufSize << "\""; LOG(error) << "invalid channel send buffer size (cannot be negative): \"" << fSndBufSize << "\"";
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -620,8 +620,8 @@ bool FairMQChannel::ValidateChannel()
if (fRcvBufSize < 0) if (fRcvBufSize < 0)
{ {
ss << "INVALID"; ss << "INVALID";
LOG(DEBUG) << ss.str(); LOG(debug) << ss.str();
LOG(ERROR) << "invalid channel receive buffer size (cannot be negative): \"" << fRcvBufSize << "\""; LOG(error) << "invalid channel receive buffer size (cannot be negative): \"" << fRcvBufSize << "\"";
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -629,8 +629,8 @@ bool FairMQChannel::ValidateChannel()
if (fSndKernelSize < 0) if (fSndKernelSize < 0)
{ {
ss << "INVALID"; ss << "INVALID";
LOG(DEBUG) << ss.str(); LOG(debug) << ss.str();
LOG(ERROR) << "invalid channel send kernel transmit size (cannot be negative): \"" << fSndKernelSize << "\""; LOG(error) << "invalid channel send kernel transmit size (cannot be negative): \"" << fSndKernelSize << "\"";
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -638,8 +638,8 @@ bool FairMQChannel::ValidateChannel()
if (fRcvKernelSize < 0) if (fRcvKernelSize < 0)
{ {
ss << "INVALID"; ss << "INVALID";
LOG(DEBUG) << ss.str(); LOG(debug) << ss.str();
LOG(ERROR) << "invalid channel receive kernel transmit size (cannot be negative): \"" << fRcvKernelSize << "\""; LOG(error) << "invalid channel receive kernel transmit size (cannot be negative): \"" << fRcvKernelSize << "\"";
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -647,19 +647,19 @@ bool FairMQChannel::ValidateChannel()
if (fRateLogging < 0) if (fRateLogging < 0)
{ {
ss << "INVALID"; ss << "INVALID";
LOG(DEBUG) << ss.str(); LOG(debug) << ss.str();
LOG(ERROR) << "invalid socket rate logging interval (cannot be negative): \"" << fRateLogging << "\""; LOG(error) << "invalid socket rate logging interval (cannot be negative): \"" << fRateLogging << "\"";
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
fIsValid = true; fIsValid = true;
ss << "VALID"; ss << "VALID";
LOG(DEBUG) << ss.str(); LOG(debug) << ss.str();
return true; return true;
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Exception caught in FairMQChannel::ValidateChannel: " << e.what(); LOG(error) << "Exception caught in FairMQChannel::ValidateChannel: " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -839,7 +839,7 @@ inline bool FairMQChannel::HandleUnblock() const
FairMQMessagePtr cmd(fTransportFactory->CreateMessage()); FairMQMessagePtr cmd(fTransportFactory->CreateMessage());
if (fChannelCmdSocket->Receive(cmd) >= 0) if (fChannelCmdSocket->Receive(cmd) >= 0)
{ {
// LOG(DEBUG) << "unblocked"; // LOG(debug) << "unblocked";
} }
return true; return true;
} }
@ -876,7 +876,7 @@ bool FairMQChannel::CheckCompatibility(unique_ptr<FairMQMessage>& msg) const
} }
else 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())); FairMQMessagePtr msgCopy(fTransportFactory->CreateMessage(msg->GetSize()));
memcpy(msgCopy->GetData(), msg->GetData(), msg->GetSize()); memcpy(msgCopy->GetData(), msg->GetData(), msg->GetSize());
msg = move(msgCopy); msg = move(msgCopy);
@ -894,7 +894,7 @@ bool FairMQChannel::CheckCompatibility(vector<unique_ptr<FairMQMessage>>& msgVec
{ {
if (fTransportType != msgVec.at(i)->GetType()) 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())); FairMQMessagePtr newMsg(fTransportFactory->CreateMessage(msgVec[i]->GetSize()));
memcpy(newMsg->GetData(), msgVec[i]->GetData(), msgVec[i]->GetSize()); memcpy(newMsg->GetData(), msgVec[i]->GetData(), msgVec[i]->GetSize());
msgVec[i] = move(newMsg); msgVec[i] = move(newMsg);

View File

@ -101,7 +101,7 @@ void FairMQDevice::InitWrapper()
{ {
if (!fTransportFactory) if (!fTransportFactory)
{ {
LOG(ERROR) << "Transport not initialized. Did you call SetTransport()?"; LOG(error) << "Transport not initialized. Did you call SetTransport()?";
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -167,7 +167,7 @@ void FairMQDevice::InitWrapper()
} }
else 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."); throw runtime_error("Cannot update configuration. Socket method (bind/connect) not specified.");
} }
// } // }
@ -180,7 +180,7 @@ void FairMQDevice::InitWrapper()
if (uninitializedBindingChannels.size() > 0) 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.")); 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) 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")); throw runtime_error(fair::mq::tools::ToString("could not connect all channels after ", fInitializationTimeoutInS, " attempts"));
} }
@ -257,7 +257,7 @@ void FairMQDevice::AttachChannels(vector<FairMQChannel*>& chans)
} }
else else
{ {
LOG(ERROR) << "failed to attach channel " << (*itr)->fName << " (" << (*itr)->fMethod << ")"; LOG(error) << "failed to attach channel " << (*itr)->fName << " (" << (*itr)->fMethod << ")";
++itr; ++itr;
} }
} }
@ -274,12 +274,12 @@ bool FairMQDevice::AttachChannel(FairMQChannel& ch)
{ {
if (ch.fTransport == "default" || ch.fTransport == fDefaultTransport) if (ch.fTransport == "default" || ch.fTransport == fDefaultTransport)
{ {
LOG(DEBUG) << ch.fName << ": using default transport"; LOG(debug) << ch.fName << ": using default transport";
ch.InitTransport(fTransportFactory); ch.InitTransport(fTransportFactory);
} }
else 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.InitTransport(AddTransport(ch.fTransport));
} }
ch.fTransportType = ch.fTransportFactory->GetType(); ch.fTransportType = ch.fTransportFactory->GetType();
@ -348,7 +348,7 @@ bool FairMQDevice::AttachChannel(FairMQChannel& ch)
} }
endpoint += address; 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 // after the book keeping is done, exit in case of errors
if (!rc) 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. // try to bind to the saved port. In case of failure, try random one.
while (!socket.Bind(endpoint)) 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; ++numAttempts;
if (numAttempts > maxAttempts) 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; return false;
} }
@ -443,7 +443,7 @@ void FairMQDevice::SortChannel(const string& name, const bool reindex)
} }
else 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) for (auto vi = fChannels[name].begin(); vi != fChannels[name].end(); ++vi)
{ {
LOG(INFO) << vi->fName << ": " LOG(info) << vi->fName << ": "
<< vi->fType << " | " << vi->fType << " | "
<< vi->fMethod << " | " << vi->fMethod << " | "
<< vi->fAddress << " | " << vi->fAddress << " | "
@ -464,7 +464,7 @@ void FairMQDevice::PrintChannel(const string& name)
} }
else 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); CallStateChangeCallbacks(RUNNING);
LOG(INFO) << "DEVICE: Running..."; LOG(info) << "DEVICE: Running...";
// start the rate logger thread // start the rate logger thread
thread rateLogger(&FairMQDevice::LogSocketRates, this); thread rateLogger(&FairMQDevice::LogSocketRates, this);
@ -524,8 +524,8 @@ void FairMQDevice::RunWrapper()
} }
catch (const out_of_range& oor) catch (const out_of_range& oor)
{ {
LOG(ERROR) << "out of range: " << oor.what(); LOG(error) << "out of range: " << oor.what();
LOG(ERROR) << "incorrect/incomplete channel configuration?"; LOG(error) << "incorrect/incomplete channel configuration?";
} }
// if Run() exited and the state is still RUNNING, transition to READY. // 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) 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); ChangeState(ERROR_FOUND);
} }
} }
@ -765,9 +765,9 @@ void FairMQDevice::Pause()
while (CheckCurrentState(PAUSED)) while (CheckCurrentState(PAUSED))
{ {
this_thread::sleep_for(chrono::milliseconds(500)); this_thread::sleep_for(chrono::milliseconds(500));
LOG(DEBUG) << "paused..."; LOG(debug) << "paused...";
} }
LOG(DEBUG) << "Unpausing"; LOG(debug) << "Unpausing";
} }
shared_ptr<FairMQTransportFactory> FairMQDevice::AddTransport(const string& transport) shared_ptr<FairMQTransportFactory> FairMQDevice::AddTransport(const string& transport)
@ -778,7 +778,7 @@ shared_ptr<FairMQTransportFactory> FairMQDevice::AddTransport(const string& tran
{ {
auto tr = FairMQTransportFactory::CreateTransportFactory(transport, fId, fConfig); auto tr = FairMQTransportFactory::CreateTransportFactory(transport, fId, fConfig);
LOG(DEBUG) << "Adding '" << transport << "' transport to the device."; LOG(debug) << "Adding '" << transport << "' transport to the device.";
pair<FairMQ::Transport, shared_ptr<FairMQTransportFactory>> trPair(FairMQ::TransportTypes.at(transport), tr); pair<FairMQ::Transport, shared_ptr<FairMQTransportFactory>> trPair(FairMQ::TransportTypes.at(transport), tr);
fTransports.insert(trPair); fTransports.insert(trPair);
@ -799,7 +799,7 @@ shared_ptr<FairMQTransportFactory> FairMQDevice::AddTransport(const string& tran
} }
else else
{ {
LOG(DEBUG) << "Reusing existing '" << transport << "' transport."; LOG(debug) << "Reusing existing '" << transport << "' transport.";
return i->second; return i->second;
} }
} }
@ -824,7 +824,7 @@ unique_ptr<FairMQTransportFactory> FairMQDevice::MakeTransport(const string& tra
#endif #endif
else else
{ {
LOG(ERROR) << "Unavailable transport requested: " << "\"" << transport << "\"" << ". Available are: " LOG(error) << "Unavailable transport requested: " << "\"" << transport << "\"" << ". Available are: "
<< "\"zeromq\"" << "\"zeromq\""
<< "\"shmem\"" << "\"shmem\""
#ifdef NANOMSG_FOUND #ifdef NANOMSG_FOUND
@ -843,7 +843,7 @@ void FairMQDevice::CreateOwnConfig()
fConfig = new FairMQProgOptions(); fConfig = new FairMQProgOptions();
string id{boost::uuids::to_string(boost::uuids::random_generator()())}; 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 // dummy argc+argv
char arg0[] = "undefined"; // executable name char arg0[] = "undefined"; // executable name
@ -871,12 +871,12 @@ void FairMQDevice::SetTransport(const string& transport)
if (fTransports.empty()) 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); fTransportFactory = AddTransport(transport);
} }
else 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); ChangeState(ERROR_FOUND);
} }
} }
@ -889,7 +889,7 @@ void FairMQDevice::SetConfig(FairMQProgOptions& config)
{ {
if (!fChannels.insert(c).second) 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<string>("transport"); fDefaultTransport = config.GetValue<string>("transport");
@ -960,7 +960,7 @@ void FairMQDevice::LogSocketRates()
t0 = get_timestamp(); t0 = get_timestamp();
LOG(DEBUG) << "<channel>: in: <#msgs> (<MB>) out: <#msgs> (<MB>)"; LOG(debug) << "<channel>: in: <#msgs> (<MB>) out: <#msgs> (<MB>)";
while (CheckCurrentState(RUNNING)) while (CheckCurrentState(RUNNING))
{ {
@ -993,7 +993,7 @@ void FairMQDevice::LogSocketRates()
bytesOut.at(i) = bytesOutNew.at(i); bytesOut.at(i) = bytesOutNew.at(i);
msgOut.at(i) = msgOutNew.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) " << "in: " << msgPerSecIn.at(i) << " (" << mbPerSecIn.at(i) << " MB) "
<< "out: " << msgPerSecOut.at(i) << " (" << mbPerSecOut.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)); this_thread::sleep_for(chrono::milliseconds(1000));
} }
} }
// LOG(DEBUG) << "FairMQDevice::LogSocketRates() stopping";
} }
void FairMQDevice::Unblock() void FairMQDevice::Unblock()
@ -1073,5 +1071,5 @@ void FairMQDevice::Exit()
FairMQDevice::~FairMQDevice() FairMQDevice::~FairMQDevice()
{ {
LOG(DEBUG) << "Destructing device " << fId; LOG(debug) << "Destructing device " << fId;
} }

View File

@ -259,7 +259,7 @@ class FairMQDevice : public FairMQStateMachine
{ {
if (type != fChannels.at(chans.at(i)).at(0).Transport()->GetType()) 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); ChangeState(ERROR_FOUND);
} }
} }
@ -279,7 +279,7 @@ class FairMQDevice : public FairMQStateMachine
{ {
if (type != channels.at(i)->Transport()->GetType()) 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); 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; bool ok = fChannelRegistry.insert(std::make_pair(channelName, std::make_pair(minNumSubChannels, maxNumSubChannels))).second;
if (!ok) if (!ok)
{ {
LOG(WARN) << "Registering channel: name already registered: \"" << channelName << "\""; LOG(warn) << "Registering channel: name already registered: \"" << channelName << "\"";
} }
return ok; return ok;
} }

View File

@ -109,7 +109,7 @@ bool FairMQStateMachine::ChangeState(int event)
} }
default: 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"; << "Supported are: INIT_DEVICE, INIT_TASK, RUN, PAUSE, STOP, RESET_TASK, RESET_DEVICE, END, ERROR_FOUND";
return false; return false;
} }
@ -117,7 +117,7 @@ bool FairMQStateMachine::ChangeState(int event)
} }
catch (std::exception& e) catch (std::exception& e)
{ {
LOG(ERROR) << "Exception in FairMQStateMachine::ChangeState(): " << e.what(); LOG(error) << "Exception in FairMQStateMachine::ChangeState(): " << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
return false; return false;
@ -149,13 +149,13 @@ void FairMQStateMachine::WaitForEndOfState(int event)
break; break;
} }
default: default:
LOG(ERROR) << "Requested state is either synchronous or does not exist."; LOG(error) << "Requested state is either synchronous or does not exist.";
break; break;
} }
} }
catch (std::exception& e) 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; return true;
} }
default: 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; return false;
} }
} }
catch (std::exception& e) catch (std::exception& e)
{ {
LOG(ERROR) << "Exception in FairMQStateMachine::WaitForEndOfStateForMs(): " << e.what(); LOG(error) << "Exception in FairMQStateMachine::WaitForEndOfStateForMs(): " << e.what();
} }
return false; return false;
} }
@ -225,7 +225,7 @@ int FairMQStateMachine::GetEventNumber(const std::string& event)
if (event == "RESET_TASK") return RESET_TASK; if (event == "RESET_TASK") return RESET_TASK;
if (event == "END") return END; if (event == "END") return END;
if (event == "ERROR_FOUND") return ERROR_FOUND; 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"; << "Supported are: INIT_DEVICE, INIT_TASK, RUN, PAUSE, STOP, RESET_DEVICE, RESET_TASK, END, ERROR_FOUND";
return -1; return -1;
} }

View File

@ -99,7 +99,7 @@ struct FairMQFSM : public msmf::state_machine_def<FairMQFSM>
template<typename Event, typename FSM> template<typename Event, typename FSM>
void on_entry(Event const&, FSM& fsm) void on_entry(Event const&, FSM& fsm)
{ {
LOG(STATE) << "Starting FairMQ state machine"; LOG(state) << "Starting FairMQ state machine";
fState = IDLE; fState = IDLE;
fsm.CallStateChangeCallbacks(IDLE); fsm.CallStateChangeCallbacks(IDLE);
@ -110,7 +110,7 @@ struct FairMQFSM : public msmf::state_machine_def<FairMQFSM>
template<typename Event, typename FSM> template<typename Event, typename FSM>
void on_exit(Event const&, FSM& /*fsm*/) void on_exit(Event const&, FSM& /*fsm*/)
{ {
LOG(STATE) << "Exiting FairMQ state machine"; LOG(state) << "Exiting FairMQ state machine";
} }
// list of FSM states // list of FSM states
@ -137,7 +137,7 @@ struct FairMQFSM : public msmf::state_machine_def<FairMQFSM>
template<typename EVT, typename FSM, typename SourceState, typename TargetState> template<typename EVT, typename FSM, typename SourceState, typename TargetState>
void operator()(EVT const&, FSM& fsm, SourceState&, TargetState&) void operator()(EVT const&, FSM& fsm, SourceState&, TargetState&)
{ {
LOG(STATE) << "Entering IDLE state"; LOG(state) << "Entering IDLE state";
fsm.fState = IDLE; fsm.fState = IDLE;
} }
}; };
@ -155,7 +155,7 @@ struct FairMQFSM : public msmf::state_machine_def<FairMQFSM>
fsm.fWorkDoneCondition.wait(lock); fsm.fWorkDoneCondition.wait(lock);
} }
fsm.fWorkAvailable = true; fsm.fWorkAvailable = true;
LOG(STATE) << "Entering INITIALIZING DEVICE state"; LOG(state) << "Entering INITIALIZING DEVICE state";
fsm.fWork = std::bind(&FairMQFSM::InitWrapper, &fsm); fsm.fWork = std::bind(&FairMQFSM::InitWrapper, &fsm);
fsm.fWorkAvailableCondition.notify_one(); fsm.fWorkAvailableCondition.notify_one();
} }
@ -166,7 +166,7 @@ struct FairMQFSM : public msmf::state_machine_def<FairMQFSM>
template<typename EVT, typename FSM, typename SourceState, typename TargetState> template<typename EVT, typename FSM, typename SourceState, typename TargetState>
void operator()(EVT const&, FSM& fsm, SourceState&, TargetState&) void operator()(EVT const&, FSM& fsm, SourceState&, TargetState&)
{ {
LOG(STATE) << "Entering DEVICE READY state"; LOG(state) << "Entering DEVICE READY state";
fsm.fState = DEVICE_READY; fsm.fState = DEVICE_READY;
} }
}; };
@ -184,7 +184,7 @@ struct FairMQFSM : public msmf::state_machine_def<FairMQFSM>
fsm.fWorkDoneCondition.wait(lock); fsm.fWorkDoneCondition.wait(lock);
} }
fsm.fWorkAvailable = true; fsm.fWorkAvailable = true;
LOG(STATE) << "Entering INITIALIZING TASK state"; LOG(state) << "Entering INITIALIZING TASK state";
fsm.fWork = std::bind(&FairMQFSM::InitTaskWrapper, &fsm); fsm.fWork = std::bind(&FairMQFSM::InitTaskWrapper, &fsm);
fsm.fWorkAvailableCondition.notify_one(); fsm.fWorkAvailableCondition.notify_one();
} }
@ -195,7 +195,7 @@ struct FairMQFSM : public msmf::state_machine_def<FairMQFSM>
template<typename EVT, typename FSM, typename SourceState, typename TargetState> template<typename EVT, typename FSM, typename SourceState, typename TargetState>
void operator()(EVT const&, FSM& fsm, SourceState&, TargetState&) void operator()(EVT const&, FSM& fsm, SourceState&, TargetState&)
{ {
LOG(STATE) << "Entering READY state"; LOG(state) << "Entering READY state";
fsm.fState = READY; fsm.fState = READY;
} }
}; };
@ -213,7 +213,7 @@ struct FairMQFSM : public msmf::state_machine_def<FairMQFSM>
fsm.fWorkDoneCondition.wait(lock); fsm.fWorkDoneCondition.wait(lock);
} }
fsm.fWorkAvailable = true; fsm.fWorkAvailable = true;
LOG(STATE) << "Entering RUNNING state"; LOG(state) << "Entering RUNNING state";
fsm.fWork = std::bind(&FairMQFSM::RunWrapper, &fsm); fsm.fWork = std::bind(&FairMQFSM::RunWrapper, &fsm);
fsm.fWorkAvailableCondition.notify_one(); fsm.fWorkAvailableCondition.notify_one();
} }
@ -233,7 +233,7 @@ struct FairMQFSM : public msmf::state_machine_def<FairMQFSM>
fsm.fWorkDoneCondition.wait(lock); fsm.fWorkDoneCondition.wait(lock);
} }
fsm.fWorkAvailable = true; fsm.fWorkAvailable = true;
LOG(STATE) << "Entering PAUSED state"; LOG(state) << "Entering PAUSED state";
fsm.fWork = std::bind(&FairMQFSM::PauseWrapper, &fsm); fsm.fWork = std::bind(&FairMQFSM::PauseWrapper, &fsm);
fsm.fWorkAvailableCondition.notify_one(); fsm.fWorkAvailableCondition.notify_one();
} }
@ -252,7 +252,7 @@ struct FairMQFSM : public msmf::state_machine_def<FairMQFSM>
fsm.fWorkDoneCondition.wait(lock); fsm.fWorkDoneCondition.wait(lock);
} }
fsm.fWorkAvailable = true; fsm.fWorkAvailable = true;
LOG(STATE) << "Entering RUNNING state"; LOG(state) << "Entering RUNNING state";
fsm.fWork = std::bind(&FairMQFSM::RunWrapper, &fsm); fsm.fWork = std::bind(&FairMQFSM::RunWrapper, &fsm);
fsm.fWorkAvailableCondition.notify_one(); fsm.fWorkAvailableCondition.notify_one();
} }
@ -271,7 +271,7 @@ struct FairMQFSM : public msmf::state_machine_def<FairMQFSM>
{ {
fsm.fWorkDoneCondition.wait(lock); 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<FairMQFSM>
{ {
fsm.fState = READY; fsm.fState = READY;
fsm.Unblock(); 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<FairMQFSM>
fsm.fWorkDoneCondition.wait(lock); fsm.fWorkDoneCondition.wait(lock);
} }
fsm.fWorkAvailable = true; fsm.fWorkAvailable = true;
LOG(STATE) << "Entering RESETTING TASK state"; LOG(state) << "Entering RESETTING TASK state";
fsm.fWork = std::bind(&FairMQFSM::ResetTaskWrapper, &fsm); fsm.fWork = std::bind(&FairMQFSM::ResetTaskWrapper, &fsm);
fsm.fWorkAvailableCondition.notify_one(); fsm.fWorkAvailableCondition.notify_one();
} }
@ -318,7 +318,7 @@ struct FairMQFSM : public msmf::state_machine_def<FairMQFSM>
fsm.fWorkDoneCondition.wait(lock); fsm.fWorkDoneCondition.wait(lock);
} }
fsm.fWorkAvailable = true; fsm.fWorkAvailable = true;
LOG(STATE) << "Entering RESETTING DEVICE state"; LOG(state) << "Entering RESETTING DEVICE state";
fsm.fWork = std::bind(&FairMQFSM::ResetWrapper, &fsm); fsm.fWork = std::bind(&FairMQFSM::ResetWrapper, &fsm);
fsm.fWorkAvailableCondition.notify_one(); fsm.fWorkAvailableCondition.notify_one();
} }
@ -329,7 +329,7 @@ struct FairMQFSM : public msmf::state_machine_def<FairMQFSM>
template<typename EVT, typename FSM, typename SourceState, typename TargetState> template<typename EVT, typename FSM, typename SourceState, typename TargetState>
void operator()(EVT const&, FSM& fsm, SourceState&, TargetState&) void operator()(EVT const&, FSM& fsm, SourceState&, TargetState&)
{ {
LOG(STATE) << "Entering EXITING state"; LOG(state) << "Entering EXITING state";
fsm.fState = EXITING; fsm.fState = EXITING;
fsm.fTerminationRequested = true; fsm.fTerminationRequested = true;
fsm.CallStateChangeCallbacks(EXITING); fsm.CallStateChangeCallbacks(EXITING);
@ -356,7 +356,7 @@ struct FairMQFSM : public msmf::state_machine_def<FairMQFSM>
template<typename EVT, typename FSM, typename SourceState, typename TargetState> template<typename EVT, typename FSM, typename SourceState, typename TargetState>
void operator()(EVT const&, FSM& fsm, SourceState&, TargetState&) void operator()(EVT const&, FSM& fsm, SourceState&, TargetState&)
{ {
LOG(STATE) << "Entering ERROR state"; LOG(state) << "Entering ERROR state";
fsm.fState = Error; fsm.fState = Error;
fsm.CallStateChangeCallbacks(Error); fsm.CallStateChangeCallbacks(Error);
} }
@ -404,10 +404,10 @@ struct FairMQFSM : public msmf::state_machine_def<FairMQFSM>
if (stateName != "OK") 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 // backward compatibility to FairMQStateMachine

View File

@ -52,7 +52,7 @@ auto FairMQTransportFactory::CreateTransportFactory(const std::string& type, con
#endif /* NANOMSG_FOUND */ #endif /* NANOMSG_FOUND */
else else
{ {
LOG(ERROR) << "Unavailable transport requested: " << "\"" << type << "\"" << ". Available are: " LOG(error) << "Unavailable transport requested: " << "\"" << type << "\"" << ". Available are: "
<< "\"zeromq\"" << "\"zeromq\""
<< "\"shmem\"" << "\"shmem\""
#ifdef NANOMSG_FOUND #ifdef NANOMSG_FOUND

View File

@ -18,10 +18,10 @@ fair::mq::Plugin::Plugin(const string name, const Version version, const string
, fkHomepage{homepage} , fkHomepage{homepage}
, fPluginServices{pluginServices} , fPluginServices{pluginServices}
{ {
LOG(DEBUG) << "Loaded plugin: " << *this; LOG(debug) << "Loaded plugin: " << *this;
} }
fair::mq::Plugin::~Plugin() fair::mq::Plugin::~Plugin()
{ {
LOG(DEBUG) << "Unloaded plugin: " << *this; LOG(debug) << "Unloaded plugin: " << *this;
} }

View File

@ -62,10 +62,10 @@ const std::unordered_map<StateMachine::StateTransition, std::string, tools::Hash
auto StateMachine::Run() -> void auto StateMachine::Run() -> void
{ {
LOG(STATE) << "Starting FairMQ state machine"; LOG(state) << "Starting FairMQ state machine";
LOG(DEBUG) << "Entering initial " << fErrorState << " state (orthogonal error state machine)"; LOG(debug) << "Entering initial " << fErrorState << " state (orthogonal error state machine)";
LOG(STATE) << "Entering initial " << fState << " state"; LOG(state) << "Entering initial " << fState << " state";
std::unique_lock<std::mutex> lock{fMutex}; std::unique_lock<std::mutex> lock{fMutex};
while (true) while (true)
@ -83,7 +83,7 @@ auto StateMachine::Run() -> void
lastState = fErrorState; lastState = fErrorState;
fErrorState = fNextStates.front(); fErrorState = fNextStates.front();
fNextStates.pop_front(); fNextStates.pop_front();
LOG(ERROR) << "Entering " << fErrorState << " state (orthogonal error state machine)"; LOG(error) << "Entering " << fErrorState << " state (orthogonal error state machine)";
} }
else else
{ {
@ -91,7 +91,7 @@ auto StateMachine::Run() -> void
lastState = fState; lastState = fState;
fState = fNextStates.front(); fState = fNextStates.front();
fNextStates.pop_front(); fNextStates.pop_front();
LOG(STATE) << "Entering " << fState << " state"; LOG(state) << "Entering " << fState << " state";
} }
lock.unlock(); lock.unlock();
@ -101,7 +101,7 @@ auto StateMachine::Run() -> void
if (fState == State::Exiting || fErrorState == State::Error) break; 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 auto StateMachine::ChangeState(StateTransition transition) -> void

View File

@ -59,7 +59,7 @@ void FairMQBenchmarkSampler::Run()
FairMQMessagePtr baseMsg(dataOutChannel.Transport()->CreateMessage(fMsgSize)); 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(); auto tStart = chrono::high_resolution_clock::now();
while (CheckCurrentState(RUNNING)) while (CheckCurrentState(RUNNING))
@ -108,7 +108,7 @@ void FairMQBenchmarkSampler::Run()
auto tEnd = chrono::high_resolution_clock::now(); auto tEnd = chrono::high_resolution_clock::now();
LOG(INFO) << "Done " << fNumIterations << " iterations in " << chrono::duration<double, milli>(tEnd - tStart).count() << "ms."; LOG(info) << "Done " << fNumIterations << " iterations in " << chrono::duration<double, milli>(tEnd - tStart).count() << "ms.";
} }

View File

@ -74,13 +74,13 @@ void FairMQMerger::Run()
{ {
if (Send(payload, fOutChannelName) < 0) if (Send(payload, fOutChannelName) < 0)
{ {
LOG(DEBUG) << "Transfer interrupted"; LOG(debug) << "Transfer interrupted";
break; break;
} }
} }
else else
{ {
LOG(DEBUG) << "Transfer interrupted"; LOG(debug) << "Transfer interrupted";
break; break;
} }
} }
@ -105,13 +105,13 @@ void FairMQMerger::Run()
{ {
if (Send(payload, fOutChannelName) < 0) if (Send(payload, fOutChannelName) < 0)
{ {
LOG(DEBUG) << "Transfer interrupted"; LOG(debug) << "Transfer interrupted";
break; break;
} }
} }
else else
{ {
LOG(DEBUG) << "Transfer interrupted"; LOG(debug) << "Transfer interrupted";
break; break;
} }
} }

View File

@ -48,13 +48,13 @@ void FairMQProxy::Run()
{ {
if (Send(payload, fOutChannelName) < 0) if (Send(payload, fOutChannelName) < 0)
{ {
LOG(DEBUG) << "Transfer interrupted"; LOG(debug) << "Transfer interrupted";
break; break;
} }
} }
else else
{ {
LOG(DEBUG) << "Transfer interrupted"; LOG(debug) << "Transfer interrupted";
break; break;
} }
} }
@ -68,13 +68,13 @@ void FairMQProxy::Run()
{ {
if (Send(payload, fOutChannelName) < 0) if (Send(payload, fOutChannelName) < 0)
{ {
LOG(DEBUG) << "Transfer interrupted"; LOG(debug) << "Transfer interrupted";
break; break;
} }
} }
else else
{ {
LOG(DEBUG) << "Transfer interrupted"; LOG(debug) << "Transfer interrupted";
break; break;
} }
} }

View File

@ -39,7 +39,7 @@ void FairMQSink::Run()
// store the channel reference to avoid traversing the map on every loop iteration // store the channel reference to avoid traversing the map on every loop iteration
FairMQChannel& dataInChannel = fChannels.at(fInChannelName).at(0); 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(); auto tStart = chrono::high_resolution_clock::now();
while (CheckCurrentState(RUNNING)) while (CheckCurrentState(RUNNING))
@ -61,7 +61,7 @@ void FairMQSink::Run()
auto tEnd = chrono::high_resolution_clock::now(); auto tEnd = chrono::high_resolution_clock::now();
LOG(INFO) << "Leaving RUNNING state. Received " << numReceivedMsgs << " messages in " << chrono::duration<double, milli>(tEnd - tStart).count() << "ms."; LOG(info) << "Leaving RUNNING state. Received " << numReceivedMsgs << " messages in " << chrono::duration<double, milli>(tEnd - tStart).count() << "ms.";
} }
FairMQSink::~FairMQSink() FairMQSink::~FairMQSink()

View File

@ -51,7 +51,7 @@ class FairMQSink : public FairMQDevice//, public OutputPolicy
// store the channel reference to avoid traversing the map on every loop iteration // store the channel reference to avoid traversing the map on every loop iteration
FairMQChannel& dataInChannel = fChannels.at(fInChannelName).at(0); 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(); auto tStart = std::chrono::high_resolution_clock::now();
while (CheckCurrentState(RUNNING)) while (CheckCurrentState(RUNNING))
@ -73,7 +73,7 @@ class FairMQSink : public FairMQDevice//, public OutputPolicy
auto tEnd = std::chrono::high_resolution_clock::now(); auto tEnd = std::chrono::high_resolution_clock::now();
LOG(INFO) << "Leaving RUNNING state. Received " << fNumIterations << " messages in " << std::chrono::duration<double, std::milli>(tEnd - tStart).count() << "ms."; LOG(info) << "Leaving RUNNING state. Received " << fNumIterations << " messages in " << std::chrono::duration<double, std::milli>(tEnd - tStart).count() << "ms.";
} }
}; };

View File

@ -34,7 +34,7 @@ FairMQMessageNN::FairMQMessageNN()
fMessage = nn_allocmsg(0, 0); fMessage = nn_allocmsg(0, 0);
if (!fMessage) 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); fMessage = nn_allocmsg(size, 0);
if (!fMessage) if (!fMessage)
{ {
LOG(ERROR) << "failed allocating message, reason: " << nn_strerror(errno); LOG(error) << "failed allocating message, reason: " << nn_strerror(errno);
} }
fSize = size; fSize = size;
} }
@ -69,7 +69,7 @@ FairMQMessageNN::FairMQMessageNN(void* data, const size_t size, fairmq_free_fn*
fMessage = nn_allocmsg(size, 0); fMessage = nn_allocmsg(size, 0);
if (!fMessage) if (!fMessage)
{ {
LOG(ERROR) << "failed allocating message, reason: " << nn_strerror(errno); LOG(error) << "failed allocating message, reason: " << nn_strerror(errno);
} }
else else
{ {
@ -108,7 +108,7 @@ void FairMQMessageNN::Rebuild(const size_t size)
fMessage = nn_allocmsg(size, 0); fMessage = nn_allocmsg(size, 0);
if (!fMessage) if (!fMessage)
{ {
LOG(ERROR) << "failed allocating message, reason: " << nn_strerror(errno); LOG(error) << "failed allocating message, reason: " << nn_strerror(errno);
} }
fSize = size; fSize = size;
fReceiving = false; fReceiving = false;
@ -120,7 +120,7 @@ void FairMQMessageNN::Rebuild(void* data, const size_t size, fairmq_free_fn* ffn
fMessage = nn_allocmsg(size, 0); fMessage = nn_allocmsg(size, 0);
if (!fMessage) if (!fMessage)
{ {
LOG(ERROR) << "failed allocating message, reason: " << nn_strerror(errno); LOG(error) << "failed allocating message, reason: " << nn_strerror(errno);
} }
else else
{ {
@ -161,7 +161,7 @@ bool FairMQMessageNN::SetUsedSize(const size_t size)
} }
else else
{ {
LOG(ERROR) << "FairMQMessageNN::SetUsedSize: cannot set used size higher than original."; LOG(error) << "cannot set used size higher than original.";
return false; return false;
} }
} }
@ -183,7 +183,7 @@ void FairMQMessageNN::Copy(const FairMQMessage& msg)
{ {
if (nn_freemsg(fMessage) < 0) 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); fMessage = nn_allocmsg(size, 0);
if (!fMessage) if (!fMessage)
{ {
LOG(ERROR) << "failed allocating message, reason: " << nn_strerror(errno); LOG(error) << "failed allocating message, reason: " << nn_strerror(errno);
} }
else else
{ {
@ -207,7 +207,7 @@ void FairMQMessageNN::Copy(const FairMQMessagePtr& msg)
{ {
if (nn_freemsg(fMessage) < 0) 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); fMessage = nn_allocmsg(size, 0);
if (!fMessage) if (!fMessage)
{ {
LOG(ERROR) << "failed allocating message, reason: " << nn_strerror(errno); LOG(error) << "failed allocating message, reason: " << nn_strerror(errno);
} }
else else
{ {
@ -229,7 +229,7 @@ void FairMQMessageNN::CloseMessage()
{ {
if (nn_freemsg(fMessage) < 0) if (nn_freemsg(fMessage) < 0)
{ {
LOG(ERROR) << "failed freeing message, reason: " << nn_strerror(errno); LOG(error) << "failed freeing message, reason: " << nn_strerror(errno);
} }
else else
{ {

View File

@ -100,8 +100,8 @@ FairMQPollerNN::FairMQPollerNN(const unordered_map<string, vector<FairMQChannel>
} }
catch (const std::out_of_range& oor) 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) << "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) << "out of range error: " << oor.what() << '\n';
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -143,7 +143,7 @@ void FairMQPollerNN::SetItemEvents(nn_pollfd& item, const int type)
} }
else else
{ {
LOG(ERROR) << "nanomsg: invalid poller configuration, exiting."; LOG(error) << "invalid poller configuration, exiting.";
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -154,12 +154,12 @@ void FairMQPollerNN::Poll(const int timeout)
{ {
if (errno == ETERM) if (errno == ETERM)
{ {
LOG(DEBUG) << "nanomsg: polling exited, reason: " << nn_strerror(errno); LOG(debug) << "polling exited, reason: " << nn_strerror(errno);
} }
else else
{ {
LOG(ERROR) << "nanomsg: polling failed, reason: " << nn_strerror(errno); LOG(error) << "polling failed, reason: " << nn_strerror(errno);
throw std::runtime_error("nanomsg: polling failed"); 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) catch (const std::out_of_range& oor)
{ {
LOG(ERROR) << "nanomsg: invalid channel key: \"" << channelKey << "\""; LOG(error) << "invalid channel key: \"" << channelKey << "\"";
LOG(ERROR) << "nanomsg: out of range error: " << oor.what() << '\n'; LOG(error) << "out of range error: " << oor.what() << '\n';
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -216,8 +216,8 @@ bool FairMQPollerNN::CheckOutput(const string channelKey, const int index)
} }
catch (const std::out_of_range& oor) catch (const std::out_of_range& oor)
{ {
LOG(ERROR) << "nanomsg: invalid channel key: \"" << channelKey << "\""; LOG(error) << "invalid channel key: \"" << channelKey << "\"";
LOG(ERROR) << "nanomsg: out of range error: " << oor.what() << '\n'; LOG(error) << "out of range error: " << oor.what() << '\n';
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }

View File

@ -51,7 +51,7 @@ FairMQSocketNN::FairMQSocketNN(const string& type, const string& name, const str
fSocket = nn_socket(AF_SP_RAW, GetConstant(type)); fSocket = nn_socket(AF_SP_RAW, GetConstant(type));
if (fSocket == -1) 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); exit(EXIT_FAILURE);
} }
} }
@ -60,7 +60,7 @@ FairMQSocketNN::FairMQSocketNN(const string& type, const string& name, const str
fSocket = nn_socket(AF_SP, GetConstant(type)); fSocket = nn_socket(AF_SP, GetConstant(type));
if (fSocket == -1) 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); exit(EXIT_FAILURE);
} }
if (type == "sub") if (type == "sub")
@ -72,24 +72,24 @@ FairMQSocketNN::FairMQSocketNN(const string& type, const string& name, const str
int sndTimeout = 700; int sndTimeout = 700;
if (nn_setsockopt(fSocket, NN_SOL_SOCKET, NN_SNDTIMEO, &sndTimeout, sizeof(sndTimeout)) != 0) 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; int rcvTimeout = 700;
if (nn_setsockopt(fSocket, NN_SOL_SOCKET, NN_RCVTIMEO, &rcvTimeout, sizeof(rcvTimeout)) != 0) 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 #ifdef NN_RCVMAXSIZE
int rcvSize = -1; int rcvSize = -1;
if (nn_setsockopt(fSocket, NN_SOL_SOCKET, NN_RCVMAXSIZE, &rcvSize, sizeof(rcvSize)) != 0) 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 #endif
// LOG(INFO) << "created socket " << fId; // LOG(info) << "created socket " << fId;
} }
string FairMQSocketNN::GetId() string FairMQSocketNN::GetId()
@ -99,12 +99,12 @@ string FairMQSocketNN::GetId()
bool FairMQSocketNN::Bind(const string& address) 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()); int eid = nn_bind(fSocket, address.c_str());
if (eid < 0) 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 false;
} }
return true; return true;
@ -112,12 +112,12 @@ bool FairMQSocketNN::Bind(const string& address)
void FairMQSocketNN::Connect(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()); int eid = nn_connect(fSocket, address.c_str());
if (eid < 0) 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) else if (nn_errno() == ETERM)
{ {
LOG(INFO) << "terminating socket " << fId; LOG(info) << "terminating socket " << fId;
return -1; return -1;
} }
else 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; return nbytes;
} }
} }
@ -220,12 +220,12 @@ int FairMQSocketNN::Receive(FairMQMessagePtr& msg, const int flags)
} }
else if (nn_errno() == ETERM) else if (nn_errno() == ETERM)
{ {
LOG(INFO) << "terminating socket " << fId; LOG(info) << "terminating socket " << fId;
return -1; return -1;
} }
else 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; return nbytes;
} }
} }
@ -288,17 +288,17 @@ int64_t FairMQSocketNN::Send(vector<FairMQMessagePtr>& msgVec, const int flags)
} }
else if (nn_errno() == ETERM) else if (nn_errno() == ETERM)
{ {
LOG(INFO) << "terminating socket " << fId; LOG(info) << "terminating socket " << fId;
return -1; return -1;
} }
else 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; return nbytes;
} }
} }
#else /*MSGPACK_FOUND*/ #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); exit(EXIT_FAILURE);
#endif /*MSGPACK_FOUND*/ #endif /*MSGPACK_FOUND*/
} }
@ -309,7 +309,7 @@ int64_t FairMQSocketNN::Receive(vector<FairMQMessagePtr>& msgVec, const int flag
// Warn if the vector is filled before Receive() and empty it. // Warn if the vector is filled before Receive() and empty it.
// if (msgVec.size() > 0) // 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(); // msgVec.clear();
// } // }
@ -370,17 +370,17 @@ int64_t FairMQSocketNN::Receive(vector<FairMQMessagePtr>& msgVec, const int flag
} }
else if (nn_errno() == ETERM) else if (nn_errno() == ETERM)
{ {
LOG(INFO) << "terminating socket " << fId; LOG(info) << "terminating socket " << fId;
return -1; return -1;
} }
else 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; return nbytes;
} }
} }
#else /*MSGPACK_FOUND*/ #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); exit(EXIT_FAILURE);
#endif /*MSGPACK_FOUND*/ #endif /*MSGPACK_FOUND*/
} }
@ -417,7 +417,7 @@ void FairMQSocketNN::SetOption(const string& option, const void* value, size_t v
int val = *(static_cast<int*>(const_cast<void*>(value))); int val = *(static_cast<int*>(const_cast<void*>(value)));
if (val <= 0) 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; 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); int rc = nn_setsockopt(fSocket, NN_SOL_SOCKET, GetConstant(option), value, valueSize);
if (rc < 0) 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); int rc = nn_getsockopt(fSocket, NN_SOL_SOCKET, GetConstant(option), value, valueSize);
if (rc < 0) 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) 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; return false;
} }
@ -481,7 +481,7 @@ int FairMQSocketNN::GetSendTimeout() const
if (nn_getsockopt(fSocket, NN_SOL_SOCKET, NN_SNDTIMEO, &timeout, &size) != 0) 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; 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) 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; return false;
} }
@ -505,7 +505,7 @@ int FairMQSocketNN::GetReceiveTimeout() const
if (nn_getsockopt(fSocket, NN_SOL_SOCKET, NN_RCVTIMEO, &timeout, &size) != 0) 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; return timeout;
@ -548,12 +548,12 @@ int FairMQSocketNN::GetConstant(const string& constant)
return NN_RCVBUF; return NN_RCVBUF;
if (constant == "snd-more") 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; return -1;
} }
if (constant == "rcv-more") 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; return -1;
} }

View File

@ -17,7 +17,7 @@ FairMQ::Transport FairMQTransportFactoryNN::fTransportType = FairMQ::Transport::
FairMQTransportFactoryNN::FairMQTransportFactoryNN(const string& id, const FairMQProgOptions* /*config*/) FairMQTransportFactoryNN::FairMQTransportFactoryNN(const string& id, const FairMQProgOptions* /*config*/)
: FairMQTransportFactory(id) : FairMQTransportFactory(id)
{ {
LOG(DEBUG) << "Transport: Using nanomsg library"; LOG(debug) << "Transport: Using nanomsg library";
} }
FairMQMessagePtr FairMQTransportFactoryNN::CreateMessage() const FairMQMessagePtr FairMQTransportFactoryNN::CreateMessage() const

View File

@ -30,6 +30,6 @@ size_t FairMQUnmanagedRegionNN::GetSize() const
FairMQUnmanagedRegionNN::~FairMQUnmanagedRegionNN() FairMQUnmanagedRegionNN::~FairMQUnmanagedRegionNN()
{ {
LOG(DEBUG) << "destroying region"; LOG(debug) << "destroying region";
free(fBuffer); free(fBuffer);
} }

View File

@ -35,8 +35,8 @@ FairMQMap ptreeToMQMap(const boost::property_tree::ptree& pt, const string& id,
if (channelMap.empty()) if (channelMap.empty())
{ {
LOG(WARN) << "---- No channel keys found for " << id; LOG(warn) << "---- No channel keys found for " << id;
LOG(WARN) << "---- Check the JSON inputs and/or command line inputs"; LOG(warn) << "---- Check the JSON inputs and/or command line inputs";
} }
return channelMap; return channelMap;
@ -88,12 +88,12 @@ void PrintDeviceList(const boost::property_tree::ptree& tree, const string& form
if (key != "") if (key != "")
{ {
deviceIdKey = 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 else
{ {
deviceIdKey = q.second.get<string>("id"); deviceIdKey = q.second.get<string>("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") if (formatFlag == "xml")
{ {
deviceIdKey = p.second.get<string>("<xmlattr>.id"); deviceIdKey = p.second.get<string>("<xmlattr>.id");
LOG(DEBUG) << "Found config for '" << deviceIdKey << "' in XML input"; LOG(debug) << "Found config for '" << deviceIdKey << "' in XML input";
} }
if (formatFlag == "json") if (formatFlag == "json")
@ -113,12 +113,12 @@ void PrintDeviceList(const boost::property_tree::ptree& tree, const string& form
if (key != "") if (key != "")
{ {
deviceIdKey = 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 else
{ {
deviceIdKey = p.second.get<string>("id"); deviceIdKey = p.second.get<string>("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; 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 each node in fairMQOptions
for (const auto& p : tree) for (const auto& p : tree)
@ -144,12 +144,12 @@ void DeviceParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap
if (key != "") if (key != "")
{ {
deviceIdKey = 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 else
{ {
deviceIdKey = q.second.get<string>("id"); deviceIdKey = q.second.get<string>("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 // if not correct device id, do not fill MQMap
@ -158,7 +158,7 @@ void DeviceParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap
continue; continue;
} }
LOG(DEBUG) << "Found with following channels:"; LOG(debug) << "Found with following channels:";
ChannelParser(q.second, channelMap, formatFlag); ChannelParser(q.second, channelMap, formatFlag);
} }
@ -179,12 +179,12 @@ void DeviceParser(const boost::property_tree::ptree& tree, FairMQMap& channelMap
if (key != "") if (key != "")
{ {
deviceIdKey = 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 else
{ {
deviceIdKey = p.second.get<string>("id"); deviceIdKey = p.second.get<string>("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; continue;
} }
LOG(DEBUG) << "Found with following channels:"; LOG(debug) << "Found with following channels:";
ChannelParser(p.second, channelMap, formatFlag); ChannelParser(p.second, channelMap, formatFlag);
} }
@ -232,19 +232,19 @@ void ChannelParser(const boost::property_tree::ptree& tree, FairMQMap& channelMa
if (numSockets > 0) if (numSockets > 0)
{ {
LOG(DEBUG) << "" << channelKey << ":"; LOG(debug) << "" << channelKey << ":";
LOG(DEBUG) << "\tnumSockets of " << numSockets << " specified,"; LOG(debug) << "\tnumSockets of " << numSockets << " specified,";
LOG(DEBUG) << "\tapplying common settings to each:"; LOG(debug) << "\tapplying common settings to each:";
LOG(DEBUG) << "\ttype = " << commonChannel.GetType(); LOG(debug) << "\ttype = " << commonChannel.GetType();
LOG(DEBUG) << "\tmethod = " << commonChannel.GetMethod(); LOG(debug) << "\tmethod = " << commonChannel.GetMethod();
LOG(DEBUG) << "\taddress = " << commonChannel.GetAddress(); LOG(debug) << "\taddress = " << commonChannel.GetAddress();
LOG(DEBUG) << "\ttransport = " << commonChannel.GetTransport(); LOG(debug) << "\ttransport = " << commonChannel.GetTransport();
LOG(DEBUG) << "\tsndBufSize = " << commonChannel.GetSndBufSize(); LOG(debug) << "\tsndBufSize = " << commonChannel.GetSndBufSize();
LOG(DEBUG) << "\trcvBufSize = " << commonChannel.GetRcvBufSize(); LOG(debug) << "\trcvBufSize = " << commonChannel.GetRcvBufSize();
LOG(DEBUG) << "\tsndKernelSize = " << commonChannel.GetSndKernelSize(); LOG(debug) << "\tsndKernelSize = " << commonChannel.GetSndKernelSize();
LOG(DEBUG) << "\trcvKernelSize = " << commonChannel.GetRcvKernelSize(); LOG(debug) << "\trcvKernelSize = " << commonChannel.GetRcvKernelSize();
LOG(DEBUG) << "\trateLogging = " << commonChannel.GetRateLogging(); LOG(debug) << "\trateLogging = " << commonChannel.GetRateLogging();
for (int i = 0; i < numSockets; ++i) for (int i = 0; i < numSockets; ++i)
{ {
@ -296,19 +296,19 @@ void ChannelParser(const boost::property_tree::ptree& tree, FairMQMap& channelMa
if (numSockets > 0) if (numSockets > 0)
{ {
LOG(DEBUG) << "" << channelKey << ":"; LOG(debug) << "" << channelKey << ":";
LOG(DEBUG) << "\tnumSockets of " << numSockets << " specified,"; LOG(debug) << "\tnumSockets of " << numSockets << " specified,";
LOG(DEBUG) << "\tapplying common settings to each:"; LOG(debug) << "\tapplying common settings to each:";
LOG(DEBUG) << "\ttype = " << commonChannel.GetType(); LOG(debug) << "\ttype = " << commonChannel.GetType();
LOG(DEBUG) << "\tmethod = " << commonChannel.GetMethod(); LOG(debug) << "\tmethod = " << commonChannel.GetMethod();
LOG(DEBUG) << "\taddress = " << commonChannel.GetAddress(); LOG(debug) << "\taddress = " << commonChannel.GetAddress();
LOG(DEBUG) << "\ttransport = " << commonChannel.GetTransport(); LOG(debug) << "\ttransport = " << commonChannel.GetTransport();
LOG(DEBUG) << "\tsndBufSize = " << commonChannel.GetSndBufSize(); LOG(debug) << "\tsndBufSize = " << commonChannel.GetSndBufSize();
LOG(DEBUG) << "\trcvBufSize = " << commonChannel.GetRcvBufSize(); LOG(debug) << "\trcvBufSize = " << commonChannel.GetRcvBufSize();
LOG(DEBUG) << "\tsndKernelSize = " << commonChannel.GetSndKernelSize(); LOG(debug) << "\tsndKernelSize = " << commonChannel.GetSndKernelSize();
LOG(DEBUG) << "\trcvKernelSize = " << commonChannel.GetRcvKernelSize(); LOG(debug) << "\trcvKernelSize = " << commonChannel.GetRcvKernelSize();
LOG(DEBUG) << "\trateLogging = " << commonChannel.GetRateLogging(); LOG(debug) << "\trateLogging = " << commonChannel.GetRateLogging();
for (int i = 0; i < numSockets; ++i) for (int i = 0; i < numSockets; ++i)
{ {
@ -351,16 +351,16 @@ void SocketParser(const boost::property_tree::ptree& tree, vector<FairMQChannel>
channel.UpdateRcvKernelSize(q.second.get<int>("rcvKernelSize", channel.GetRcvKernelSize())); channel.UpdateRcvKernelSize(q.second.get<int>("rcvKernelSize", channel.GetRcvKernelSize()));
channel.UpdateRateLogging(q.second.get<int>("rateLogging", channel.GetRateLogging())); channel.UpdateRateLogging(q.second.get<int>("rateLogging", channel.GetRateLogging()));
LOG(DEBUG) << "" << channelName << "[" << socketCounter << "]:"; LOG(debug) << "" << channelName << "[" << socketCounter << "]:";
LOG(DEBUG) << "\ttype = " << channel.GetType(); LOG(debug) << "\ttype = " << channel.GetType();
LOG(DEBUG) << "\tmethod = " << channel.GetMethod(); LOG(debug) << "\tmethod = " << channel.GetMethod();
LOG(DEBUG) << "\taddress = " << channel.GetAddress(); LOG(debug) << "\taddress = " << channel.GetAddress();
LOG(DEBUG) << "\ttransport = " << channel.GetTransport(); LOG(debug) << "\ttransport = " << channel.GetTransport();
LOG(DEBUG) << "\tsndBufSize = " << channel.GetSndBufSize(); LOG(debug) << "\tsndBufSize = " << channel.GetSndBufSize();
LOG(DEBUG) << "\trcvBufSize = " << channel.GetRcvBufSize(); LOG(debug) << "\trcvBufSize = " << channel.GetRcvBufSize();
LOG(DEBUG) << "\tsndKernelSize = " << channel.GetSndKernelSize(); LOG(debug) << "\tsndKernelSize = " << channel.GetSndKernelSize();
LOG(DEBUG) << "\trcvKernelSize = " << channel.GetRcvKernelSize(); LOG(debug) << "\trcvKernelSize = " << channel.GetRcvKernelSize();
LOG(DEBUG) << "\trateLogging = " << channel.GetRateLogging(); LOG(debug) << "\trateLogging = " << channel.GetRateLogging();
channelList.push_back(channel); channelList.push_back(channel);
++socketCounter; ++socketCounter;
@ -383,16 +383,16 @@ void SocketParser(const boost::property_tree::ptree& tree, vector<FairMQChannel>
channel.UpdateRcvKernelSize(p.second.get<int>("rcvKernelSize", channel.GetRcvKernelSize())); channel.UpdateRcvKernelSize(p.second.get<int>("rcvKernelSize", channel.GetRcvKernelSize()));
channel.UpdateRateLogging(p.second.get<int>("rateLogging", channel.GetRateLogging())); channel.UpdateRateLogging(p.second.get<int>("rateLogging", channel.GetRateLogging()));
LOG(DEBUG) << "" << channelName << "[" << socketCounter << "]:"; LOG(debug) << "" << channelName << "[" << socketCounter << "]:";
LOG(DEBUG) << "\ttype = " << channel.GetType(); LOG(debug) << "\ttype = " << channel.GetType();
LOG(DEBUG) << "\tmethod = " << channel.GetMethod(); LOG(debug) << "\tmethod = " << channel.GetMethod();
LOG(DEBUG) << "\taddress = " << channel.GetAddress(); LOG(debug) << "\taddress = " << channel.GetAddress();
LOG(DEBUG) << "\ttransport = " << channel.GetTransport(); LOG(debug) << "\ttransport = " << channel.GetTransport();
LOG(DEBUG) << "\tsndBufSize = " << channel.GetSndBufSize(); LOG(debug) << "\tsndBufSize = " << channel.GetSndBufSize();
LOG(DEBUG) << "\trcvBufSize = " << channel.GetRcvBufSize(); LOG(debug) << "\trcvBufSize = " << channel.GetRcvBufSize();
LOG(DEBUG) << "\tsndKernelSize = " << channel.GetSndKernelSize(); LOG(debug) << "\tsndKernelSize = " << channel.GetSndKernelSize();
LOG(DEBUG) << "\trcvKernelSize = " << channel.GetRcvKernelSize(); LOG(debug) << "\trcvKernelSize = " << channel.GetRcvKernelSize();
LOG(DEBUG) << "\trateLogging = " << channel.GetRateLogging(); LOG(debug) << "\trateLogging = " << channel.GetRateLogging();
channelList.push_back(channel); channelList.push_back(channel);
++socketCounter; ++socketCounter;
@ -401,25 +401,25 @@ void SocketParser(const boost::property_tree::ptree& tree, vector<FairMQChannel>
if (socketCounter) if (socketCounter)
{ {
LOG(DEBUG) << "Found " << socketCounter << " socket(s) in channel."; LOG(debug) << "Found " << socketCounter << " socket(s) in channel.";
} }
else else
{ {
LOG(DEBUG) << "" << channelName << ":"; LOG(debug) << "" << channelName << ":";
LOG(DEBUG) << "\tNo sockets specified,"; LOG(debug) << "\tNo sockets specified,";
LOG(DEBUG) << "\tapplying common settings to the channel:"; LOG(debug) << "\tapplying common settings to the channel:";
FairMQChannel channel(commonChannel); FairMQChannel channel(commonChannel);
LOG(DEBUG) << "\ttype = " << channel.GetType(); LOG(debug) << "\ttype = " << channel.GetType();
LOG(DEBUG) << "\tmethod = " << channel.GetMethod(); LOG(debug) << "\tmethod = " << channel.GetMethod();
LOG(DEBUG) << "\taddress = " << channel.GetAddress(); LOG(debug) << "\taddress = " << channel.GetAddress();
LOG(DEBUG) << "\ttransport = " << channel.GetTransport(); LOG(debug) << "\ttransport = " << channel.GetTransport();
LOG(DEBUG) << "\tsndBufSize = " << channel.GetSndBufSize(); LOG(debug) << "\tsndBufSize = " << channel.GetSndBufSize();
LOG(DEBUG) << "\trcvBufSize = " << channel.GetRcvBufSize(); LOG(debug) << "\trcvBufSize = " << channel.GetRcvBufSize();
LOG(DEBUG) << "\tsndKernelSize = " << channel.GetSndKernelSize(); LOG(debug) << "\tsndKernelSize = " << channel.GetSndKernelSize();
LOG(DEBUG) << "\trcvKernelSize = " << channel.GetRcvKernelSize(); LOG(debug) << "\trcvKernelSize = " << channel.GetRcvKernelSize();
LOG(DEBUG) << "\trateLogging = " << channel.GetRateLogging(); LOG(debug) << "\trateLogging = " << channel.GetRateLogging();
channelList.push_back(channel); channelList.push_back(channel);
} }

View File

@ -99,10 +99,10 @@ int FairMQProgOptions::ParseAll(const int argc, char const* const* argv, bool al
if (!optionExists) 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) for (const auto& p : MQParserKeys)
{ {
LOG(WARNING) << " --" << p; LOG(warn) << " --" << p;
} }
LOG(warn) << "No channels will be created (You can create them manually)."; 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 cmdline mq-config called then use the default xml/json parser
if (fVarMap.count("mq-config")) 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<string>(); string file = fVarMap["mq-config"].as<string>();
@ -149,7 +149,7 @@ int FairMQProgOptions::ParseAll(const int argc, char const* const* argv, bool al
} }
else if (fVarMap.count("config-json-string")) 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<FairMQ::ToString>().Run(fVarMap.at("config-json-string")); string value = FairMQ::ConvertVariableValue<FairMQ::ToString>().Run(fVarMap.at("config-json-string"));
stringstream ss; 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")) 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<FairMQ::ToString>().Run(fVarMap.at("config-xml-string")); string value = FairMQ::ConvertVariableValue<FairMQ::ToString>().Run(fVarMap.at("config-xml-string"));
stringstream ss; 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)) else if (fVarMap.count(FairMQParser::SUBOPT::OptionKeyChannelConfig))
{ {
LOG(DEBUG) << "channel-config: Parsing channel configuration"; LOG(debug) << "channel-config: Parsing channel configuration";
UserParser<FairMQParser::SUBOPT>(fVarMap, id); UserParser<FairMQParser::SUBOPT>(fVarMap, id);
} }
} }
@ -325,7 +325,7 @@ int FairMQProgOptions::UpdateChannelMap(const string& channelName, int index, co
else else
{ {
//if we get there it means something is wrong //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; << channelName << "." << index << "." << member;
return 1; return 1;
} }
@ -353,7 +353,7 @@ int FairMQProgOptions::UpdateChannelMap(const string& channelName, int index, co
else else
{ {
// if we get there it means something is wrong // 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; return 1;
} }
} }

View File

@ -62,7 +62,7 @@ class FairMQProgOptions : public FairProgOptions
} }
catch (std::exception& e) catch (std::exception& e)
{ {
LOG(ERROR) << e.what(); LOG(error) << e.what();
return 1; return 1;
} }
return 0; return 0;

View File

@ -64,7 +64,7 @@ FairMQMap SUBOPT::UserParser(const po::variables_map& omap, const std::string& d
else else
{ {
// TODO: what is the error policy here, should we abort? // 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) for (auto channelProperty : channelProperties)

View File

@ -195,7 +195,7 @@ int FairProgOptions::PrintOptions()
} }
ss << setfill ('*') << setw(totalLength + 3) << "*";// +3 for " = " ss << setfill ('*') << setw(totalLength + 3) << "*";// +3 for " = "
LOG(DEBUG) << ss.str(); LOG(debug) << ss.str();
return 0; return 0;
} }

View File

@ -98,7 +98,7 @@ class FairProgOptions
} }
else else
{ {
LOG(ERROR) << "Config has no key: " << key; LOG(error) << "Config has no key: " << key;
} }
} }
catch (std::exception& e) catch (std::exception& e)
@ -125,8 +125,8 @@ class FairProgOptions
} }
catch (std::exception& e) catch (std::exception& e)
{ {
LOG(ERROR) << "Exception thrown for the key '" << key << "'"; LOG(error) << "Exception thrown for the key '" << key << "'";
LOG(ERROR) << e.what(); LOG(error) << e.what();
} }
return valueStr; return valueStr;
@ -152,7 +152,7 @@ class FairProgOptions
} }
else 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";
} }
} }

View File

@ -68,8 +68,8 @@ int main(int argc, char** argv)
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << e.what(); LOG(error) << e.what();
LOG(INFO) << "Command line options are the following : "; LOG(info) << "Command line options are the following : ";
config.PrintHelp(); config.PrintHelp();
return 1; return 1;
} }

View File

@ -62,8 +62,8 @@ int main(int argc, char** argv)
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << e.what(); LOG(error) << e.what();
LOG(INFO) << "Command line options are the following : "; LOG(info) << "Command line options are the following : ";
config.PrintHelp(); config.PrintHelp();
return 1; return 1;
} }

View File

@ -13,7 +13,7 @@
// Parse xml from file // Parse xml from file
int testXML1(FairMQProgOptions* config) int testXML1(FairMQProgOptions* config)
{ {
LOG(INFO)<<"--------- test XML1 ---------\n"; LOG(info)<<"--------- test XML1 ---------\n";
std::string filename; std::string filename;
std::string XMLrootNode; std::string XMLrootNode;
@ -25,14 +25,14 @@ int testXML1(FairMQProgOptions* config)
config->UserParser<FairMQParser::MQXML2>(filename); config->UserParser<FairMQParser::MQXML2>(filename);
config->UserParser<FairMQParser::MQXML3>(filename,"merger"); config->UserParser<FairMQParser::MQXML3>(filename,"merger");
LOG(INFO)<<"--------- test XML1 end ---------\n"; LOG(info)<<"--------- test XML1 end ---------\n";
return 0; return 0;
} }
// Parse xml from command line // Parse xml from command line
int testXML2(FairMQProgOptions* config) int testXML2(FairMQProgOptions* config)
{ {
LOG(INFO)<<"--------- test XML2 ---------\n"; LOG(info)<<"--------- test XML2 ---------\n";
std::string XML; std::string XML;
std::string XMLrootNode; std::string XMLrootNode;
std::string id=config->GetValue<std::string>("id"); std::string id=config->GetValue<std::string>("id");
@ -45,14 +45,14 @@ int testXML2(FairMQProgOptions* config)
iss << XML; iss << XML;
config->UserParser<FairMQParser::XML>(iss,id,XMLrootNode); config->UserParser<FairMQParser::XML>(iss,id,XMLrootNode);
LOG(INFO)<<"--------- test XML2 end ---------\n"; LOG(info)<<"--------- test XML2 end ---------\n";
return 0; return 0;
} }
// Parse json from file // Parse json from file
int testJSON1(FairMQProgOptions* config) int testJSON1(FairMQProgOptions* config)
{ {
LOG(INFO)<<"--------- test JSON1 ---------\n"; LOG(info)<<"--------- test JSON1 ---------\n";
std::string filename; std::string filename;
std::string JSONrootNode; std::string JSONrootNode;
std::string id=config->GetValue<std::string>("id"); std::string id=config->GetValue<std::string>("id");
@ -62,14 +62,14 @@ int testJSON1(FairMQProgOptions* config)
config->UserParser<FairMQParser::JSON>(filename,id,JSONrootNode); config->UserParser<FairMQParser::JSON>(filename,id,JSONrootNode);
LOG(INFO)<<"--------- test JSON1 end ---------\n"; LOG(info)<<"--------- test JSON1 end ---------\n";
return 0; return 0;
} }
// Parse json from command line // Parse json from command line
int testJSON2(FairMQProgOptions* config) int testJSON2(FairMQProgOptions* config)
{ {
LOG(INFO)<<"--------- test JSON2 ---------\n"; LOG(info)<<"--------- test JSON2 ---------\n";
std::string JSON; std::string JSON;
std::string JSONrootNode; std::string JSONrootNode;
std::string id=config->GetValue<std::string>("id"); std::string id=config->GetValue<std::string>("id");
@ -82,7 +82,7 @@ int testJSON2(FairMQProgOptions* config)
iss << JSON; iss << JSON;
config->UserParser<FairMQParser::JSON>(iss,id,JSONrootNode); config->UserParser<FairMQParser::JSON>(iss,id,JSONrootNode);
LOG(INFO)<<"--------- test JSON2 end ---------\n"; LOG(info)<<"--------- test JSON2 end ---------\n";
return 0; return 0;
} }
@ -134,7 +134,7 @@ int main(int argc, char** argv)
} }
catch (std::exception& e) catch (std::exception& e)
{ {
LOG(ERROR) << e.what(); LOG(error) << e.what();
return 1; return 1;
} }
return 0; return 0;

View File

@ -62,7 +62,7 @@ int main(int argc, char** argv)
} }
catch (std::exception& e) catch (std::exception& e)
{ {
MQLOG(ERROR) << e.what(); LOG(error) << e.what();
return 1; return 1;
} }
return 0; return 0;

View File

@ -46,7 +46,7 @@ class MyDevice : public FairMQDevice
void Print() void Print()
{ {
LOG(INFO) << "[MyDevice] rate = " << fRate; LOG(info) << "[MyDevice] rate = " << fRate;
} }
private: private:
@ -96,61 +96,61 @@ int main(int argc, char** argv)
// string dataRateStr = config.GetStringValue("data-rate"); // string dataRateStr = config.GetStringValue("data-rate");
// double dataRate = config.ConvertTo<double>(dataRateStr); // double dataRate = config.ConvertTo<double>(dataRateStr);
// LOG(INFO) << "dataRate: " << dataRate; // LOG(info) << "dataRate: " << dataRate;
LOG(INFO) << "Subscribing: <string>(chans.data.0.address)"; LOG(info) << "Subscribing: <string>(chans.data.0.address)";
config.Subscribe<string>("test", [&device](const string& key, string value) config.Subscribe<string>("test", [&device](const string& key, string value)
{ {
if (key == "chans.data.0.address") 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); device.fChannels.at("data").at(0).UpdateAddress(value);
} }
}); });
LOG(INFO) << "Subscribing: <int>(chans.data.0.rcvBufSize)"; LOG(info) << "Subscribing: <int>(chans.data.0.rcvBufSize)";
config.Subscribe<int>("test", [&device](const string& key, int value) config.Subscribe<int>("test", [&device](const string& key, int value)
{ {
if(key == "chans.data.0.rcvBufSize") 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); device.fChannels.at("data").at(0).UpdateRcvBufSize(value);
} }
}); });
LOG(INFO) << "Subscribing: <double>(data-rate)"; LOG(info) << "Subscribing: <double>(data-rate)";
config.Subscribe<double>("test", [&device](const string& key, double value) config.Subscribe<double>("test", [&device](const string& key, double value)
{ {
if (key == "data-rate") if (key == "data-rate")
{ {
LOG(INFO) << "[callback] Updating device parameter " << key << " = " << value; LOG(info) << "[callback] Updating device parameter " << key << " = " << value;
device.SetRate(value); device.SetRate(value);
} }
}); });
LOG(INFO) << "Starting value updates...\n"; LOG(info) << "Starting value updates...\n";
config.UpdateValue<string>("chans.data.0.address", "tcp://localhost:4321"); config.UpdateValue<string>("chans.data.0.address", "tcp://localhost:4321");
LOG(INFO) << "config: " << config.GetValue<string>("chans.data.0.address"); LOG(info) << "config: " << config.GetValue<string>("chans.data.0.address");
LOG(INFO) << "device: " << device.fChannels.at("data").at(0).GetAddress() << endl; LOG(info) << "device: " << device.fChannels.at("data").at(0).GetAddress() << endl;
config.UpdateValue<int>("chans.data.0.rcvBufSize", 100); config.UpdateValue<int>("chans.data.0.rcvBufSize", 100);
LOG(INFO) << "config: " << config.GetValue<int>("chans.data.0.rcvBufSize"); LOG(info) << "config: " << config.GetValue<int>("chans.data.0.rcvBufSize");
LOG(INFO) << "device: " << device.fChannels.at("data").at(0).GetRcvBufSize() << endl; LOG(info) << "device: " << device.fChannels.at("data").at(0).GetRcvBufSize() << endl;
config.UpdateValue<double>("data-rate", 0.9); config.UpdateValue<double>("data-rate", 0.9);
LOG(INFO) << "config: " << config.GetValue<double>("data-rate"); LOG(info) << "config: " << config.GetValue<double>("data-rate");
LOG(INFO) << "device: " << device.GetRate() << endl; LOG(info) << "device: " << device.GetRate() << endl;
// device.Print(); // device.Print();
LOG(INFO) << "nase: " << config.GetValue<double>("nase"); LOG(info) << "nase: " << config.GetValue<double>("nase");
config.Unsubscribe<string>("test"); config.Unsubscribe<string>("test");
config.Unsubscribe<int>("test"); config.Unsubscribe<int>("test");
config.Unsubscribe<double>("test"); config.Unsubscribe<double>("test");
// advanced commands // advanced commands
// LOG(INFO) << "-------------------- start custom 1"; // LOG(info) << "-------------------- start custom 1";
// config.Connect<EventId::Custom, MyDevice&, double>("myNewKey", [](MyDevice& d, double val) // config.Connect<EventId::Custom, MyDevice&, double>("myNewKey", [](MyDevice& d, double val)
// { // {
@ -160,14 +160,14 @@ int main(int argc, char** argv)
// config.Emit<EventId::Custom, MyDevice&, double>("myNewKey", device, 0.123); // config.Emit<EventId::Custom, MyDevice&, double>("myNewKey", device, 0.123);
// LOG(INFO) << "-------------------- start custom 2 with function"; // LOG(info) << "-------------------- start custom 2 with function";
// config.Connect<EventId::Custom, MyDevice&, double>("function example", &MyCallBack); // config.Connect<EventId::Custom, MyDevice&, double>("function example", &MyCallBack);
// config.Emit<EventId::Custom, MyDevice&, double>("function example", device, 6.66); // config.Emit<EventId::Custom, MyDevice&, double>("function example", device, 6.66);
} }
catch (exception& e) 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"; << e.what() << ", application will now exit";
return 1; return 1;
} }

View File

@ -50,27 +50,27 @@ Control::Control(const string name, const Plugin::Version version, const string
if (control == "static") if (control == "static")
{ {
LOG(DEBUG) << "Running builtin controller: static"; LOG(debug) << "Running builtin controller: static";
fControllerThread = thread(&Control::StaticMode, this); fControllerThread = thread(&Control::StaticMode, this);
} }
else if (control == "interactive") else if (control == "interactive")
{ {
LOG(DEBUG) << "Running builtin controller: interactive"; LOG(debug) << "Running builtin controller: interactive";
fControllerThread = thread(&Control::InteractiveMode, this); fControllerThread = thread(&Control::InteractiveMode, this);
} }
else 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); fControllerThread = thread(&Control::StaticMode, this);
} }
} }
catch (PluginServices::DeviceControlError& e) 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. // If we are here, it means another plugin has taken control. That's fine, just print the exception message and do nothing else.
LOG(DEBUG) << e.what(); LOG(debug) << e.what();
} }
LOG(DEBUG) << "catch-signals: " << GetProperty<int>("catch-signals"); LOG(debug) << "catch-signals: " << GetProperty<int>("catch-signals");
if (GetProperty<int>("catch-signals") > 0) if (GetProperty<int>("catch-signals") > 0)
{ {
gSignalHandlerClosure = bind(&Control::SignalHandler, this, placeholders::_1); gSignalHandlerClosure = bind(&Control::SignalHandler, this, placeholders::_1);
@ -79,7 +79,7 @@ Control::Control(const string name, const Plugin::Version version, const string
} }
else 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) switch (input)
{ {
case 'i': case 'i':
LOG(INFO) << "\n\n --> [i] init device\n"; LOG(info) << "\n\n --> [i] init device\n";
ChangeDeviceState(DeviceStateTransition::InitDevice); ChangeDeviceState(DeviceStateTransition::InitDevice);
break; break;
case 'j': case 'j':
LOG(INFO) << "\n\n --> [j] init task\n"; LOG(info) << "\n\n --> [j] init task\n";
ChangeDeviceState(DeviceStateTransition::InitTask); ChangeDeviceState(DeviceStateTransition::InitTask);
break; break;
case 'p': case 'p':
LOG(INFO) << "\n\n --> [p] pause\n"; LOG(info) << "\n\n --> [p] pause\n";
ChangeDeviceState(DeviceStateTransition::Pause); ChangeDeviceState(DeviceStateTransition::Pause);
break; break;
case 'r': case 'r':
LOG(INFO) << "\n\n --> [r] run\n"; LOG(info) << "\n\n --> [r] run\n";
ChangeDeviceState(DeviceStateTransition::Run); ChangeDeviceState(DeviceStateTransition::Run);
break; break;
case 's': case 's':
LOG(INFO) << "\n\n --> [s] stop\n"; LOG(info) << "\n\n --> [s] stop\n";
ChangeDeviceState(DeviceStateTransition::Stop); ChangeDeviceState(DeviceStateTransition::Stop);
break; break;
case 't': case 't':
LOG(INFO) << "\n\n --> [t] reset task\n"; LOG(info) << "\n\n --> [t] reset task\n";
ChangeDeviceState(DeviceStateTransition::ResetTask); ChangeDeviceState(DeviceStateTransition::ResetTask);
break; break;
case 'd': case 'd':
LOG(INFO) << "\n\n --> [d] reset device\n"; LOG(info) << "\n\n --> [d] reset device\n";
ChangeDeviceState(DeviceStateTransition::ResetDevice); ChangeDeviceState(DeviceStateTransition::ResetDevice);
break; break;
case 'h': case 'h':
LOG(INFO) << "\n\n --> [h] help\n"; LOG(info) << "\n\n --> [h] help\n";
PrintInteractiveHelp(); PrintInteractiveHelp();
break; break;
// case 'x': // case 'x':
// LOG(INFO) << "\n\n --> [x] ERROR\n"; // LOG(info) << "\n\n --> [x] ERROR\n";
// ChangeDeviceState(DeviceStateTransition::ERROR_FOUND); // ChangeDeviceState(DeviceStateTransition::ERROR_FOUND);
// break; // break;
case 'q': case 'q':
LOG(INFO) << "\n\n --> [q] end\n"; LOG(info) << "\n\n --> [q] end\n";
keepRunning = false; keepRunning = false;
break; break;
default: default:
LOG(INFO) << "Invalid input: [" << input << "]"; LOG(info) << "Invalid input: [" << input << "]";
PrintInteractiveHelp(); PrintInteractiveHelp();
break; break;
} }
@ -191,13 +191,13 @@ auto Control::InteractiveMode() -> void
catch (PluginServices::DeviceControlError& e) 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. // 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 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"; << "[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) 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. // 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(); StealDeviceControl();
LOG(INFO) << "Received device shutdown request (signal " << signal << ")."; LOG(info) << "Received device shutdown request (signal " << signal << ").";
LOG(INFO) << "Waiting for graceful device shutdown. Hit Ctrl-C again to abort immediately."; LOG(info) << "Waiting for graceful device shutdown. Hit Ctrl-C again to abort immediately.";
UnsubscribeFromDeviceStateChange(); // In case, static or interactive mode have subscribed already UnsubscribeFromDeviceStateChange(); // In case, static or interactive mode have subscribed already
SubscribeToDeviceStateChange([&](DeviceState newState) SubscribeToDeviceStateChange([&](DeviceState newState)
@ -267,8 +267,8 @@ auto Control::SignalHandler(int signal) -> void
} }
else else
{ {
LOG(WARN) << "Received 2nd device shutdown request (signal " << signal << ")."; LOG(warn) << "Received 2nd device shutdown request (signal " << signal << ").";
LOG(WARN) << "Aborting immediately !"; LOG(warn) << "Aborting immediately !";
abort(); abort();
} }
} }

View File

@ -53,11 +53,11 @@ DDS::DDS(const string name, const Plugin::Version version, const string maintain
} }
catch (PluginServices::DeviceControlError& e) catch (PluginServices::DeviceControlError& e)
{ {
LOG(DEBUG) << e.what(); LOG(debug) << e.what();
} }
catch (exception& e) 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. // subscribe for DDS service errors.
fService.subscribeOnError([](const dds::intercom_api::EErrorCode errorCode, const string& errorMsg) { 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(); SubscribeForConnectingChannels();
// subscribe to device state changes, pushing new state chenges into the event queue // subscribe to device state changes, pushing new state chenges into the event queue
@ -94,7 +94,7 @@ auto DDS::HandleControl() -> void
string id = GetProperty<string>("id"); string id = GetProperty<string>("id");
for (auto subscriberId : fStateChangeSubscribers) 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)); 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)); fStopCondition.wait_for(lock, chrono::seconds(1));
} }
LOG(DEBUG) << "Stopping DDS control plugin"; LOG(debug) << "Stopping DDS control plugin";
} }
catch (exception& e) catch (exception& e)
{ {
LOG(ERROR) << "Error: " << e.what() << endl; LOG(error) << "Error: " << e.what() << endl;
return; return;
} }
@ -158,7 +158,7 @@ auto DDS::FillChannelContainers() -> void
else if (GetProperty<string>(methodKey) == "connect") else if (GetProperty<string>(methodKey) == "connect")
{ {
fConnectingChans.insert(make_pair(c.first, DDSConfig())); 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) for (int i = 0; i < c.second; ++i)
{ {
fConnectingChans.at(c.first).fSubChannelAddresses.push_back(string()); fConnectingChans.at(c.first).fSubChannelAddresses.push_back(string());
@ -166,7 +166,7 @@ auto DDS::FillChannelContainers() -> void
} }
else 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; return;
} }
} }
@ -177,7 +177,7 @@ auto DDS::SubscribeForConnectingChannels() -> void
fDDSKeyValue.subscribe([&] (const string& propertyId, const string& key, const string& value) fDDSKeyValue.subscribe([&] (const string& propertyId, const string& key, const string& value)
{ {
try { try {
LOG(DEBUG) << "Received update for " << propertyId << ": key=" << key << " value=" << value; LOG(debug) << "Received update for " << propertyId << ": key=" << key << " value=" << value;
fConnectingChans.at(propertyId).fDDSValues.insert(make_pair<string, string>(key.c_str(), value.c_str())); fConnectingChans.at(propertyId).fDDSValues.insert(make_pair<string, string>(key.c_str(), value.c_str()));
// update channels and remove them from unfinished container // update channels and remove them from unfinished container
@ -203,7 +203,7 @@ auto DDS::SubscribeForConnectingChannels() -> void
} }
} catch (const exception& e) } 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; unsigned int index = 0;
for (const auto& i : chan.second) 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); fDDSKeyValue.putValue(chan.first, i);
++index; ++index;
} }
@ -245,7 +245,7 @@ auto DDS::SubscribeForCustomCommands() -> void
fDDSCustomCmd.subscribe([id, pid, this](const string& cmd, const string& cond, uint64_t senderId) 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") if (cmd == "check-state")
{ {
@ -302,7 +302,7 @@ auto DDS::SubscribeForCustomCommands() -> void
} }
fDDSCustomCmd.send("state-changes-subscription: " + id + ",OK", to_string(senderId)); fDDSCustomCmd.send("state-changes-subscription: " + id + ",OK", to_string(senderId));
auto state = GetCurrentDeviceState(); 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)); fDDSCustomCmd.send("state-change: " + id + "," + ToStr(state), to_string(senderId));
} }
else if (cmd == "unsubscribe-from-state-changes") else if (cmd == "unsubscribe-from-state-changes")
@ -315,9 +315,9 @@ auto DDS::SubscribeForCustomCommands() -> void
} }
else else
{ {
LOG(WARN) << "Unknown command: " << cmd; LOG(warn) << "Unknown command: " << cmd;
LOG(WARN) << "Origin: " << senderId; LOG(warn) << "Origin: " << senderId;
LOG(WARN) << "Destination: " << cond; LOG(warn) << "Destination: " << cond;
} }
}); });
} }

View File

@ -56,12 +56,12 @@ int main(int argc, char* argv[])
} }
catch (std::exception& e) 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; return 1;
} }
catch (...) 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; return 1;
} }
} }

View File

@ -39,7 +39,7 @@ FairMQMessageSHM::FairMQMessageSHM(Manager& manager)
{ {
if (zmq_msg_init(&fMessage) != 0) 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; fMetaCreated = true;
} }
@ -104,7 +104,7 @@ FairMQMessageSHM::FairMQMessageSHM(Manager& manager, FairMQUnmanagedRegionPtr& r
if (zmq_msg_init_size(&fMessage, sizeof(MetaHeader)) != 0) 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 else
{ {
@ -120,8 +120,8 @@ FairMQMessageSHM::FairMQMessageSHM(Manager& manager, FairMQUnmanagedRegionPtr& r
} }
else else
{ {
LOG(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("shmem: 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) catch (bipc::bad_alloc& ba)
{ {
// LOG(WARN) << "Shared memory full..."; // LOG(warn) << "Shared memory full...";
this_thread::sleep_for(chrono::milliseconds(50)); this_thread::sleep_for(chrono::milliseconds(50));
if (fInterrupted) if (fInterrupted)
{ {
@ -155,7 +155,7 @@ bool FairMQMessageSHM::InitializeChunk(const size_t size)
if (zmq_msg_init_size(&fMessage, sizeof(MetaHeader)) != 0) 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; return false;
} }
MetaHeader header; MetaHeader header;
@ -178,7 +178,7 @@ void FairMQMessageSHM::Rebuild()
if (zmq_msg_init(&fMessage) != 0) 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; fMetaCreated = true;
} }
@ -238,7 +238,7 @@ void* FairMQMessageSHM::GetData() const
} }
else else
{ {
// LOG(WARN) << "could not get pointer from a region message"; // LOG(warn) << "could not get pointer from a region message";
fLocalPtr = nullptr; fLocalPtr = nullptr;
} }
return fLocalPtr; return fLocalPtr;
@ -273,13 +273,13 @@ bool FairMQMessageSHM::SetUsedSize(const size_t size)
} }
catch (bipc::interprocess_exception& e) 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; return false;
} }
} }
else else
{ {
LOG(ERROR) << "FairMQMessageSHM::SetUsedSize: cannot set used size higher than original."; LOG(error) << "cannot set used size higher than original.";
return false; return false;
} }
} }
@ -303,12 +303,12 @@ void FairMQMessageSHM::Copy(const FairMQMessage& msg)
} }
else else
{ {
LOG(ERROR) << "FairMQMessageSHM::Copy() fail: source message not initialized!"; LOG(error) << "copy fail: source message not initialized!";
} }
} }
else 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 else
{ {
LOG(ERROR) << "FairMQMessageSHM::Copy() fail: source message not initialized!"; LOG(error) << "copy fail: source message not initialized!";
} }
} }
else 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); // RegionBlock block(fHandle, fSize);
// if (fManager.GetRegionQueue(fRegionId).try_send(static_cast<void*>(&block), sizeof(RegionBlock), 0)) // if (fManager.GetRegionQueue(fRegionId).try_send(static_cast<void*>(&block), sizeof(RegionBlock), 0))
// { // {
// // LOG(INFO) << "true"; // // LOG(info) << "true";
// } // }
// // else // // else
// // { // // {
// // LOG(DEBUG) << "could not send ack"; // // LOG(debug) << "could not send ack";
// // } // // }
// timed version // timed version
@ -379,12 +379,12 @@ void FairMQMessageSHM::CloseMessage()
{ {
break; break;
} }
LOG(DEBUG) << "region ack queue is full, retrying..."; LOG(debug) << "region ack queue is full, retrying...";
} }
} }
else 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; success = true;
} }
} }
@ -396,7 +396,7 @@ void FairMQMessageSHM::CloseMessage()
{ {
if (zmq_msg_close(&fMessage) != 0) if (zmq_msg_close(&fMessage) != 0)
{ {
LOG(ERROR) << "failed closing message, reason: " << zmq_strerror(errno); LOG(error) << "failed closing message, reason: " << zmq_strerror(errno);
} }
} }
} }

View File

@ -103,8 +103,8 @@ FairMQPollerSHM::FairMQPollerSHM(const unordered_map<string, vector<FairMQChanne
} }
catch (const std::out_of_range& oor) catch (const std::out_of_range& oor)
{ {
LOG(ERROR) << "shmem: at least one of the provided channel keys for poller initialization is invalid"; LOG(error) << "at least one of the provided channel keys for poller initialization is invalid";
LOG(ERROR) << "shmem: out of range error: " << oor.what() << '\n'; LOG(error) << "out of range error: " << oor.what() << '\n';
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -148,7 +148,7 @@ void FairMQPollerSHM::SetItemEvents(zmq_pollitem_t& item, const int type)
} }
else else
{ {
LOG(ERROR) << "zeromq: invalid poller configuration, exiting."; LOG(error) << "invalid poller configuration, exiting.";
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -159,12 +159,12 @@ void FairMQPollerSHM::Poll(const int timeout)
{ {
if (errno == ETERM) if (errno == ETERM)
{ {
LOG(DEBUG) << "shmem: polling exited, reason: " << zmq_strerror(errno); LOG(debug) << "polling exited, reason: " << zmq_strerror(errno);
} }
else else
{ {
LOG(ERROR) << "shmem: polling failed, reason: " << zmq_strerror(errno); LOG(error) << "polling failed, reason: " << zmq_strerror(errno);
throw std::runtime_error("shmem: polling failed"); throw std::runtime_error("polling failed");
} }
} }
} }
@ -202,8 +202,8 @@ bool FairMQPollerSHM::CheckInput(const string channelKey, const int index)
} }
catch (const std::out_of_range& oor) catch (const std::out_of_range& oor)
{ {
LOG(ERROR) << "shmem: invalid channel key: \"" << channelKey << "\""; LOG(error) << "invalid channel key: \"" << channelKey << "\"";
LOG(ERROR) << "shmem: out of range error: " << oor.what() << '\n'; LOG(error) << "out of range error: " << oor.what() << '\n';
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -221,8 +221,8 @@ bool FairMQPollerSHM::CheckOutput(const string channelKey, const int index)
} }
catch (const std::out_of_range& oor) catch (const std::out_of_range& oor)
{ {
LOG(ERROR) << "shmem: Invalid channel key: \"" << channelKey << "\""; LOG(error) << "Invalid channel key: \"" << channelKey << "\"";
LOG(ERROR) << "shmem: out of range error: " << oor.what() << '\n'; LOG(error) << "out of range error: " << oor.what() << '\n';
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }

View File

@ -36,13 +36,13 @@ FairMQSocketSHM::FairMQSocketSHM(Manager& manager, const string& type, const str
if (fSocket == nullptr) if (fSocket == nullptr)
{ {
LOG(ERROR) << "Failed creating socket " << fId << ", reason: " << zmq_strerror(errno); LOG(error) << "Failed creating socket " << fId << ", reason: " << zmq_strerror(errno);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (zmq_setsockopt(fSocket, ZMQ_IDENTITY, fId.c_str(), fId.length()) != 0) if (zmq_setsockopt(fSocket, ZMQ_IDENTITY, fId.c_str(), fId.length()) != 0)
{ {
LOG(ERROR) << "Failed setting ZMQ_IDENTITY socket option, reason: " << zmq_strerror(errno); LOG(error) << "Failed setting ZMQ_IDENTITY socket option, reason: " << zmq_strerror(errno);
} }
// Tell socket to try and send/receive outstanding messages for <linger> milliseconds before terminating. // Tell socket to try and send/receive outstanding messages for <linger> milliseconds before terminating.
@ -50,30 +50,30 @@ FairMQSocketSHM::FairMQSocketSHM(Manager& manager, const string& type, const str
int linger = 1000; int linger = 1000;
if (zmq_setsockopt(fSocket, ZMQ_LINGER, &linger, sizeof(linger)) != 0) 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; int sndTimeout = 700;
if (zmq_setsockopt(fSocket, ZMQ_SNDTIMEO, &sndTimeout, sizeof(sndTimeout)) != 0) 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; int rcvTimeout = 700;
if (zmq_setsockopt(fSocket, ZMQ_RCVTIMEO, &rcvTimeout, sizeof(rcvTimeout)) != 0) 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 (type == "sub")
{ {
if (zmq_setsockopt(fSocket, ZMQ_SUBSCRIBE, nullptr, 0) != 0) 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() string FairMQSocketSHM::GetId()
@ -83,7 +83,7 @@ string FairMQSocketSHM::GetId()
bool FairMQSocketSHM::Bind(const string& address) 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) 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. // 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; 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 false;
} }
return true; return true;
@ -99,11 +99,11 @@ bool FairMQSocketSHM::Bind(const string& address)
void FairMQSocketSHM::Connect(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) 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. // error here means incorrect configuration. exit if it happens.
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -142,12 +142,12 @@ int FairMQSocketSHM::Send(FairMQMessagePtr& msg, const int flags)
} }
else if (zmq_errno() == ETERM) else if (zmq_errno() == ETERM)
{ {
LOG(INFO) << "terminating socket " << fId; LOG(info) << "terminating socket " << fId;
return -1; return -1;
} }
else 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; return nbytes;
} }
} }
@ -196,12 +196,12 @@ int FairMQSocketSHM::Receive(FairMQMessagePtr& msg, const int flags)
} }
else if (zmq_errno() == ETERM) else if (zmq_errno() == ETERM)
{ {
LOG(INFO) << "terminating socket " << fId; LOG(info) << "terminating socket " << fId;
return -1; return -1;
} }
else 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; return nbytes;
} }
} }
@ -249,10 +249,10 @@ int64_t FairMQSocketSHM::Send(vector<FairMQMessagePtr>& msgVec, const int flags)
} }
if (zmq_errno() == ETERM) if (zmq_errno() == ETERM)
{ {
LOG(INFO) << "terminating socket " << fId; LOG(info) << "terminating socket " << fId;
return -1; 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; return nbytes;
} }
} }
@ -276,7 +276,7 @@ int64_t FairMQSocketSHM::Send(vector<FairMQMessagePtr>& msgVec, const int flags)
} }
else // if the vector is empty, something might be wrong 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; return -1;
} }
} }
@ -292,7 +292,7 @@ int64_t FairMQSocketSHM::Receive(vector<FairMQMessagePtr>& msgVec, const int fla
// Warn if the vector is filled before Receive() and empty it. // Warn if the vector is filled before Receive() and empty it.
// if (msgVec.size() > 0) // 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(); // msgVec.clear();
// } // }
@ -360,7 +360,7 @@ int64_t FairMQSocketSHM::Receive(vector<FairMQMessagePtr>& msgVec, const int fla
void FairMQSocketSHM::Close() void FairMQSocketSHM::Close()
{ {
// LOG(DEBUG) << "Closing socket " << fId; // LOG(debug) << "Closing socket " << fId;
if (fSocket == nullptr) if (fSocket == nullptr)
{ {
@ -369,7 +369,7 @@ void FairMQSocketSHM::Close()
if (zmq_close(fSocket) != 0) 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; 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) 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) 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) 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; return false;
} }
if (zmq_setsockopt(fSocket, ZMQ_SNDTIMEO, &timeout, sizeof(int)) != 0) 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; return false;
} }
if (zmq_bind(fSocket, address.c_str()) != 0) 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; return false;
} }
} }
@ -460,23 +460,23 @@ bool FairMQSocketSHM::SetSendTimeout(const int timeout, const string& address, c
{ {
if (zmq_disconnect(fSocket, address.c_str()) != 0) 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; return false;
} }
if (zmq_setsockopt(fSocket, ZMQ_SNDTIMEO, &timeout, sizeof(int)) != 0) 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; return false;
} }
if (zmq_connect(fSocket, address.c_str()) != 0) 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; return false;
} }
} }
else else
{ {
LOG(ERROR) << "SetSendTimeout() failed - unknown method provided!"; LOG(error) << "timeout failed - unknown method provided!";
return false; return false;
} }
@ -490,7 +490,7 @@ int FairMQSocketSHM::GetSendTimeout() const
if (zmq_getsockopt(fSocket, ZMQ_SNDTIMEO, &timeout, &size) != 0) 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; return timeout;
@ -502,17 +502,17 @@ bool FairMQSocketSHM::SetReceiveTimeout(const int timeout, const string& address
{ {
if (zmq_unbind(fSocket, address.c_str()) != 0) 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; return false;
} }
if (zmq_setsockopt(fSocket, ZMQ_RCVTIMEO, &timeout, sizeof(int)) != 0) 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; return false;
} }
if (zmq_bind(fSocket, address.c_str()) != 0) 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; return false;
} }
} }
@ -520,23 +520,23 @@ bool FairMQSocketSHM::SetReceiveTimeout(const int timeout, const string& address
{ {
if (zmq_disconnect(fSocket, address.c_str()) != 0) 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; return false;
} }
if (zmq_setsockopt(fSocket, ZMQ_RCVTIMEO, &timeout, sizeof(int)) != 0) 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; return false;
} }
if (zmq_connect(fSocket, address.c_str()) != 0) 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; return false;
} }
} }
else else
{ {
LOG(ERROR) << "SetReceiveTimeout() failed - unknown method provided!"; LOG(error) << "timeout failed - unknown method provided!";
return false; return false;
} }
@ -550,7 +550,7 @@ int FairMQSocketSHM::GetReceiveTimeout() const
if (zmq_getsockopt(fSocket, ZMQ_RCVTIMEO, &timeout, &size) != 0) 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; return timeout;

View File

@ -46,13 +46,13 @@ FairMQTransportFactorySHM::FairMQTransportFactorySHM(const string& id, const Fai
{ {
int major, minor, patch; int major, minor, patch;
zmq_version(&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) << ")"; << "boost::interprocess (" << (BOOST_VERSION / 100000) << "." << (BOOST_VERSION / 100 % 1000) << "." << (BOOST_VERSION % 100) << ")";
fContext = zmq_ctx_new(); fContext = zmq_ctx_new();
if (!fContext) if (!fContext)
{ {
LOG(ERROR) << "failed creating context, reason: " << zmq_strerror(errno); LOG(error) << "failed creating context, reason: " << zmq_strerror(errno);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -68,7 +68,7 @@ FairMQTransportFactorySHM::FairMQTransportFactorySHM(const string& id, const Fai
} }
else else
{ {
LOG(WARN) << "shmem: FairMQProgOptions not available! Using defaults."; LOG(warn) << "FairMQProgOptions not available! Using defaults.";
} }
try try
@ -77,17 +77,17 @@ FairMQTransportFactorySHM::FairMQTransportFactorySHM(const string& id, const Fai
if (zmq_ctx_set(fContext, ZMQ_IO_THREADS, numIoThreads) != 0) 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. // Set the maximum number of allowed sockets on the context.
if (zmq_ctx_set(fContext, ZMQ_MAX_SOCKETS, 10000) != 0) 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<Manager>(fSessionName, segmentSize); fManager = fair::mq::tools::make_unique<Manager>(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<bipc::named_mutex> lock(*fShMutex); bipc::scoped_lock<bipc::named_mutex> lock(*fShMutex);
@ -95,15 +95,15 @@ FairMQTransportFactorySHM::FairMQTransportFactorySHM(const string& id, const Fai
fDeviceCounter = fManager->Segment().find<DeviceCounter>(bipc::unique_instance).first; fDeviceCounter = fManager->Segment().find<DeviceCounter>(bipc::unique_instance).first;
if (fDeviceCounter) 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)++; (fDeviceCounter->fCount)++;
LOG(DEBUG) << "shmem: incremented device counter, now: " << fDeviceCounter->fCount; LOG(debug) << "incremented device counter, now: " << fDeviceCounter->fCount;
} }
else 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<DeviceCounter>(bipc::unique_instance)(1); fDeviceCounter = fManager->Segment().construct<DeviceCounter>(bipc::unique_instance)(1);
LOG(DEBUG) << "shmem: initialized device counter with: " << fDeviceCounter->fCount; LOG(debug) << "initialized device counter with: " << fDeviceCounter->fCount;
} }
// start shm monitor // start shm monitor
@ -112,24 +112,24 @@ FairMQTransportFactorySHM::FairMQTransportFactorySHM(const string& id, const Fai
// MonitorStatus* monitorStatus = fManagementSegment.find<MonitorStatus>(bipc::unique_instance).first; // MonitorStatus* monitorStatus = fManagementSegment.find<MonitorStatus>(bipc::unique_instance).first;
// if (monitorStatus == nullptr) // if (monitorStatus == nullptr)
// { // {
// LOG(DEBUG) << "shmem: no shmmonitor found, starting..."; // LOG(debug) << "no shmmonitor found, starting...";
// StartMonitor(); // StartMonitor();
// } // }
// else // else
// { // {
// LOG(DEBUG) << "shmem: found shmmonitor."; // LOG(debug) << "found shmmonitor.";
// } // }
// } // }
// catch (std::exception& e) // 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); // exit(EXIT_FAILURE);
// } // }
} }
} }
catch(bipc::interprocess_exception& e) 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."); 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"))) 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; return;
} }
// TODO: replace with Boost.Process once boost 1.64 is available // TODO: replace with Boost.Process once boost 1.64 is available
int r = system("shmmonitor --self-destruct &"); int r = system("shmmonitor --self-destruct &");
LOG(DEBUG) << r; LOG(debug) << r;
do do
{ {
MonitorStatus* monitorStatus = fManager->ManagementSegment().find<MonitorStatus>(bipc::unique_instance).first; MonitorStatus* monitorStatus = fManager->ManagementSegment().find<MonitorStatus>(bipc::unique_instance).first;
if (monitorStatus) if (monitorStatus)
{ {
LOG(DEBUG) << "shmem: shmmonitor started"; LOG(debug) << "shmmonitor started";
break; break;
} }
else else
@ -164,7 +164,7 @@ void FairMQTransportFactorySHM::StartMonitor()
this_thread::sleep_for(std::chrono::milliseconds(10)); this_thread::sleep_for(std::chrono::milliseconds(10));
if (++numTries > 100) 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); exit(EXIT_FAILURE);
} }
} }
@ -188,13 +188,13 @@ void FairMQTransportFactorySHM::SendHeartbeats()
} }
else else
{ {
LOG(DEBUG) << "control queue timeout"; LOG(debug) << "control queue timeout";
} }
} }
catch (bipc::interprocess_exception& ie) catch (bipc::interprocess_exception& ie)
{ {
this_thread::sleep_for(chrono::milliseconds(500)); 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) if (errno == EINTR)
{ {
LOG(ERROR) << "shmem: failed closing context, reason: " << zmq_strerror(errno); LOG(error) << "failed closing context, reason: " << zmq_strerror(errno);
} }
else else
{ {
@ -272,7 +272,7 @@ FairMQTransportFactorySHM::~FairMQTransportFactorySHM()
} }
else else
{ {
LOG(ERROR) << "shmem: Terminate(): context not available for shutdown"; LOG(error) << "context not available for shutdown";
} }
bool lastRemoved = false; bool lastRemoved = false;
@ -284,14 +284,14 @@ FairMQTransportFactorySHM::~FairMQTransportFactorySHM()
if (fDeviceCounter->fCount == 0) if (fDeviceCounter->fCount == 0)
{ {
LOG(DEBUG) << "shmem: last segment user, removing segment."; LOG(debug) << "last segment user, removing segment.";
fManager->RemoveSegment(); fManager->RemoveSegment();
lastRemoved = true; lastRemoved = true;
} }
else else
{ {
LOG(DEBUG) << "shmem: other segment users present (" << fDeviceCounter->fCount << "), not removing it."; LOG(debug) << "other segment users present (" << fDeviceCounter->fCount << "), not removing it.";
} }
} }

View File

@ -25,15 +25,15 @@ FairMQUnmanagedRegionSHM::FairMQUnmanagedRegionSHM(Manager& manager, const size_
RegionCounter* rc = fManager.ManagementSegment().find<RegionCounter>(bipc::unique_instance).first; RegionCounter* rc = fManager.ManagementSegment().find<RegionCounter>(bipc::unique_instance).first;
if (rc) 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)++; (rc->fCount)++;
LOG(DEBUG) << "shmem: incremented region counter, now: " << rc->fCount; LOG(debug) << "incremented region counter, now: " << rc->fCount;
} }
else 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<RegionCounter>(bipc::unique_instance)(1); rc = fManager.ManagementSegment().construct<RegionCounter>(bipc::unique_instance)(1);
LOG(DEBUG) << "shmem: initialized region counter with: " << rc->fCount; LOG(debug) << "initialized region counter with: " << rc->fCount;
} }
fRegionId = rc->fCount; fRegionId = rc->fCount;
@ -42,8 +42,8 @@ FairMQUnmanagedRegionSHM::FairMQUnmanagedRegionSHM(Manager& manager, const size_
} }
catch (bipc::interprocess_exception& e) catch (bipc::interprocess_exception& e)
{ {
LOG(ERROR) << "shmem: cannot create region. Already created/not cleaned up?"; LOG(error) << "cannot create region. Already created/not cleaned up?";
LOG(ERROR) << e.what(); LOG(error) << e.what();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }

View File

@ -58,7 +58,7 @@ bipc::mapped_region* Manager::CreateRegion(const size_t size, const uint64_t id,
auto it = fRegions.find(id); auto it = fRegions.find(id);
if (it != fRegions.end()) 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; return nullptr;
} }
else else
@ -88,7 +88,7 @@ Region* Manager::GetRemoteRegion(const uint64_t id)
} }
catch (bipc::interprocess_exception& e) catch (bipc::interprocess_exception& e)
{ {
// LOG(WARN) << "remote region (" << id << ") no longer exists"; // LOG(warn) << "remote region (" << id << ") no longer exists";
return nullptr; return nullptr;
} }
@ -104,20 +104,20 @@ void Manager::RemoveSegment()
{ {
if (bipc::shared_memory_object::remove(fSegmentName.c_str())) 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 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())) 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 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?";
} }
} }

View File

@ -38,19 +38,19 @@ Region::Region(Manager& manager, uint64_t id, uint64_t size, bool remote, FairMQ
if (fRemote) if (fRemote)
{ {
fShmemObject = bipc::shared_memory_object(bipc::open_only, fName.c_str(), bipc::read_write); 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::message_queue>(bipc::open_only, fQueueName.c_str()); fQueue = fair::mq::tools::make_unique<bipc::message_queue>(bipc::open_only, fQueueName.c_str());
LOG(DEBUG) << "shmem: located remote region queue: " << fQueueName; LOG(debug) << "shmem: located remote region queue: " << fQueueName;
} }
else else
{ {
fShmemObject = bipc::shared_memory_object(bipc::create_only, fName.c_str(), bipc::read_write); 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); fShmemObject.truncate(size);
fQueue = fair::mq::tools::make_unique<bipc::message_queue>(bipc::create_only, fQueueName.c_str(), 10000, sizeof(RegionBlock)); fQueue = fair::mq::tools::make_unique<bipc::message_queue>(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); // TODO: add HUGEPAGES flag here
// fRegion = bipc::mapped_region(fShmemObject, bipc::read_write, 0, 0, 0, MAP_HUGETLB | MAP_HUGE_1GB); // 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; RegionBlock block;
if (fQueue->timed_receive(&block, sizeof(RegionBlock), recvdSize, priority, rcvTill)) 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) if (fCallback)
{ {
fCallback(reinterpret_cast<char*>(fRegion.get_address()) + block.fHandle, block.fSize, reinterpret_cast<void*>(block.fHint)); fCallback(reinterpret_cast<char*>(fRegion.get_address()) + block.fHandle, block.fSize, reinterpret_cast<void*>(block.fHint));
@ -80,11 +80,11 @@ void Region::ReceiveAcks()
} }
else else
{ {
// LOG(DEBUG) << "queue " << fQueueName << " timeout!"; // LOG(debug) << "queue " << fQueueName << " timeout!";
} }
} // while !fStop } // while !fStop
LOG(DEBUG) << "worker for " << fName << " leaving."; LOG(debug) << "worker for " << fName << " leaving.";
} }
Region::~Region() Region::~Region()
@ -99,18 +99,18 @@ Region::~Region()
if (bipc::shared_memory_object::remove(fName.c_str())) 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())) if (bipc::message_queue::remove(fQueueName.c_str()))
{ {
LOG(DEBUG) << "shmem: removed region queue " << fName; LOG(debug) << "shmem: removed region queue " << fName;
} }
} }
else else
{ {
// LOG(DEBUG) << "shmem: region '" << fName << "' 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"; LOG(debug) << "shmem: region queue '" << fQueueName << "' is remote, no cleanup necessary";
} }
} }

View File

@ -40,11 +40,11 @@ FairMQShmPrototypeSampler::FairMQShmPrototypeSampler()
{ {
if (shared_memory_object::remove("FairMQSharedMemoryPrototype")) 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 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")) 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 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<int>("msg-rate"); fMsgRate = fConfig->GetValue<int>("msg-rate");
SegmentManager::Instance().InitializeSegment("open_or_create", "FairMQSharedMemoryPrototype", 2000000000); 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."; << SegmentManager::Instance().Segment()->get_free_memory() << " bytes.";
} }
@ -75,7 +75,7 @@ void FairMQShmPrototypeSampler::Run()
// count sent messages (also used in creating ShmChunk container ID) // count sent messages (also used in creating ShmChunk container ID)
static uint64_t numSentMsgs = 0; 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 // start rate logger and acknowledgement listener in separate threads
thread rateLogger(&FairMQShmPrototypeSampler::Log, this, 1000); thread rateLogger(&FairMQShmPrototypeSampler::Log, this, 1000);
@ -123,7 +123,7 @@ void FairMQShmPrototypeSampler::Run()
// } // }
// catch (bipc::bad_alloc& ba) // catch (bipc::bad_alloc& ba)
// { // {
// LOG(WARN) << "Shared memory full..."; // LOG(warn) << "Shared memory full...";
// this_thread::sleep_for(chrono::milliseconds(100)); // this_thread::sleep_for(chrono::milliseconds(100));
// continue; // continue;
// } // }
@ -139,12 +139,12 @@ void FairMQShmPrototypeSampler::Run()
// charnum = 97; // charnum = 97;
// } // }
// LOG(DEBUG) << "chunk handle: " << owner->fPtr->GetHandle(); // LOG(debug) << "chunk handle: " << owner->fPtr->GetHandle();
// LOG(DEBUG) << "chunk size: " << owner->fPtr->GetSize(); // LOG(debug) << "chunk size: " << owner->fPtr->GetSize();
// LOG(DEBUG) << "owner (" << ownerID << ") use count: " << owner->fPtr.use_count(); // LOG(debug) << "owner (" << ownerID << ") use count: " << owner->fPtr.use_count();
// char* cptr = static_cast<char*>(ptr); // char* cptr = static_cast<char*>(ptr);
// LOG(DEBUG) << "check: " << cptr[3]; // LOG(debug) << "check: " << cptr[3];
// FairMQMessagePtr msg(NewSimpleMessage(ownerID)); // FairMQMessagePtr msg(NewSimpleMessage(ownerID));
@ -156,9 +156,9 @@ void FairMQShmPrototypeSampler::Run()
metaPtr->fSize = fMsgSize; metaPtr->fSize = fMsgSize;
metaPtr->fHandle = handle; metaPtr->fHandle = handle;
// LOG(INFO) << metaPtr->fSize; // LOG(info) << metaPtr->fSize;
// LOG(INFO) << metaPtr->fHandle; // LOG(info) << metaPtr->fHandle;
// LOG(WARN) << ptr; // LOG(warn) << ptr;
if (Send(msg, "meta", 0) > 0) 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(); rateLogger.join();
// resetMsgCounter.join(); // resetMsgCounter.join();
@ -207,7 +207,7 @@ void FairMQShmPrototypeSampler::Log(const int intervalInMs)
msgPerSecOut = static_cast<double>(fMsgOutNew - fMsgOut) / static_cast<double>(msSinceLastLog) * 1000.; msgPerSecOut = static_cast<double>(fMsgOutNew - fMsgOut) / static_cast<double>(msSinceLastLog) * 1000.;
fMsgOut = fMsgOutNew; fMsgOut = fMsgOutNew;
LOG(DEBUG) << fixed LOG(debug) << fixed
<< setprecision(0) << "out: " << msgPerSecOut << " msg (" << setprecision(0) << "out: " << msgPerSecOut << " msg ("
<< setprecision(2) << mbPerSecOut << " MB)\t(" << setprecision(2) << mbPerSecOut << " MB)\t("
<< SegmentManager::Instance().Segment()->get_free_memory() / (1024. * 1024.) << " MB free)"; << SegmentManager::Instance().Segment()->get_free_memory() / (1024. * 1024.) << " MB free)";

View File

@ -44,7 +44,7 @@ FairMQShmPrototypeSink::~FairMQShmPrototypeSink()
void FairMQShmPrototypeSink::Init() void FairMQShmPrototypeSink::Init()
{ {
SegmentManager::Instance().InitializeSegment("open_or_create", "FairMQSharedMemoryPrototype", 2000000000); 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."; << SegmentManager::Instance().Segment()->get_free_memory() << " bytes.";
} }
@ -65,9 +65,9 @@ void FairMQShmPrototypeSink::Run()
bipc::managed_shared_memory::handle_t handle = hdr->fHandle; bipc::managed_shared_memory::handle_t handle = hdr->fHandle;
void* ptr = SegmentManager::Instance().Segment()->get_address_from_handle(handle); void* ptr = SegmentManager::Instance().Segment()->get_address_from_handle(handle);
// LOG(INFO) << size; // LOG(info) << size;
// LOG(INFO) << handle; // LOG(info) << handle;
// LOG(WARN) << ptr; // LOG(warn) << ptr;
fBytesInNew += size; fBytesInNew += size;
++fMsgInNew; ++fMsgInNew;
@ -78,21 +78,21 @@ void FairMQShmPrototypeSink::Run()
// find the shared pointer in shared memory with its ID // find the shared pointer in shared memory with its ID
// ShPtrOwner* owner = SegmentManager::Instance().Segment()->find<ShPtrOwner>(ownerID.c_str()).first; // ShPtrOwner* owner = SegmentManager::Instance().Segment()->find<ShPtrOwner>(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) // if (owner)
// { // {
// // void* ptr = owner->fPtr->GetData(); // // void* ptr = owner->fPtr->GetData();
// // LOG(DEBUG) << "chunk handle: " << owner->fPtr->GetHandle(); // // LOG(debug) << "chunk handle: " << owner->fPtr->GetHandle();
// // LOG(DEBUG) << "chunk size: " << owner->fPtr->GetSize(); // // LOG(debug) << "chunk size: " << owner->fPtr->GetSize();
// fBytesInNew += owner->fPtr->GetSize(); // fBytesInNew += owner->fPtr->GetSize();
// ++fMsgInNew; // ++fMsgInNew;
// // char* cptr = static_cast<char*>(ptr); // // char* cptr = static_cast<char*>(ptr);
// // LOG(DEBUG) << "check: " << cptr[3]; // // LOG(debug) << "check: " << cptr[3];
// SegmentManager::Instance().Segment()->deallocate(ptr); // SegmentManager::Instance().Segment()->deallocate(ptr);
@ -100,7 +100,7 @@ void FairMQShmPrototypeSink::Run()
// } // }
// else // 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(); rateLogger.join();
} }
@ -134,7 +134,7 @@ void FairMQShmPrototypeSink::Log(const int intervalInMs)
msgPerSecIn = static_cast<double>(fMsgInNew - fMsgIn) / static_cast<double>(msSinceLastLog) * 1000.; msgPerSecIn = static_cast<double>(fMsgInNew - fMsgIn) / static_cast<double>(msSinceLastLog) * 1000.;
fMsgIn = fMsgInNew; fMsgIn = fMsgInNew;
LOG(DEBUG) << fixed LOG(debug) << fixed
<< setprecision(0) << "in: " << msgPerSecIn << " msg (" << setprecision(0) << "in: " << msgPerSecIn << " msg ("
<< setprecision(2) << mbPerSecIn << " MB)\t(" << setprecision(2) << mbPerSecIn << " MB)\t("
<< SegmentManager::Instance().Segment()->get_free_memory() / (1024. * 1024.) << " MB free)"; << SegmentManager::Instance().Segment()->get_free_memory() / (1024. * 1024.) << " MB free)";

View File

@ -64,13 +64,13 @@ class SegmentManager
{ {
if (++numTries == 5) 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); exit(EXIT_FAILURE);
} }
else else
{ {
LOG(DEBUG) << "Could not open shared memory segment on try " << numTries << ". Retrying in 1 second..."; LOG(debug) << "Could not open shared memory segment on try " << numTries << ". Retrying in 1 second...";
LOG(DEBUG) << ie.what(); LOG(debug) << ie.what();
std::this_thread::sleep_for(std::chrono::milliseconds(1000)); std::this_thread::sleep_for(std::chrono::milliseconds(1000));
} }
@ -80,18 +80,18 @@ class SegmentManager
} }
else 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) 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); exit(EXIT_FAILURE);
} }
} }
else else
{ {
LOG(INFO) << "Segment already initialized"; LOG(info) << "Segment already initialized";
} }
} }
@ -103,7 +103,7 @@ class SegmentManager
} }
else else
{ {
LOG(ERROR) << "Segment not initialized"; LOG(error) << "Segment not initialized";
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }

View File

@ -44,11 +44,11 @@ class Receiver : public FairMQDevice
auto msg = FairMQMessagePtr{NewMessage()}; auto msg = FairMQMessagePtr{NewMessage()};
if (Receive(msg, fChannelName) >= 0) if (Receive(msg, fChannelName) >= 0)
{ {
LOG(INFO) << "received empty message"; LOG(info) << "received empty message";
} }
else else
{ {
LOG(ERROR) << "fair::mq::test::Receiver::Run(): Receive(msg, fChannelName) < 0"; LOG(error) << "fair::mq::test::Receiver::Run(): Receive(msg, fChannelName) < 0";
} }
}; };

View File

@ -44,11 +44,11 @@ class Sender : public FairMQDevice
auto msg = FairMQMessagePtr{NewMessage()}; auto msg = FairMQMessagePtr{NewMessage()};
if (Send(msg, fChannelName) >= 0) if (Send(msg, fChannelName) >= 0)
{ {
LOG(INFO) << "sent empty message"; LOG(info) << "sent empty message";
} }
else else
{ {
LOG(ERROR) << "fair::mq::test::Sender::Run(): Send(msg, fChannelName) < 0"; LOG(error) << "fair::mq::test::Sender::Run(): Send(msg, fChannelName) < 0";
} }
}; };

View File

@ -61,7 +61,7 @@ class PollIn : public FairMQDevice
} }
else else
{ {
LOG(ERROR) << "wrong poll type provided: " << fPollType; LOG(error) << "wrong poll type provided: " << fPollType;
} }
bool arrived1 = false; bool arrived1 = false;
@ -79,7 +79,7 @@ class PollIn : public FairMQDevice
{ {
if (poller->CheckInput(0)) if (poller->CheckInput(0))
{ {
LOG(DEBUG) << "CheckInput(0) triggered"; LOG(debug) << "CheckInput(0) triggered";
if (Receive(msg1, "data1", 0) >= 0) if (Receive(msg1, "data1", 0) >= 0)
{ {
arrived1 = true; arrived1 = true;
@ -88,7 +88,7 @@ class PollIn : public FairMQDevice
if (poller->CheckInput(1)) if (poller->CheckInput(1))
{ {
LOG(DEBUG) << "CheckInput(1) triggered"; LOG(debug) << "CheckInput(1) triggered";
if (Receive(msg2, "data2", 0) >= 0) if (Receive(msg2, "data2", 0) >= 0)
{ {
arrived2 = true; arrived2 = true;
@ -99,7 +99,7 @@ class PollIn : public FairMQDevice
{ {
if (poller->CheckInput("data1", 0)) if (poller->CheckInput("data1", 0))
{ {
LOG(DEBUG) << "CheckInput(\"data1\", 0) triggered"; LOG(debug) << "CheckInput(\"data1\", 0) triggered";
if (Receive(msg1, "data1", 0) >= 0) if (Receive(msg1, "data1", 0) >= 0)
{ {
arrived1 = true; arrived1 = true;
@ -108,7 +108,7 @@ class PollIn : public FairMQDevice
if (poller->CheckInput("data2", 0)) if (poller->CheckInput("data2", 0))
{ {
LOG(DEBUG) << "CheckInput(\"data2\", 0) triggered"; LOG(debug) << "CheckInput(\"data2\", 0) triggered";
if (Receive(msg2, "data2", 0) >= 0) if (Receive(msg2, "data2", 0) >= 0)
{ {
arrived2 = true; arrived2 = true;
@ -119,7 +119,7 @@ class PollIn : public FairMQDevice
if (arrived1 && arrived2) if (arrived1 && arrived2)
{ {
bothArrived = true; bothArrived = true;
LOG(INFO) << "POLL test successfull"; LOG(info) << "POLL test successfull";
} }
} }
}; };

View File

@ -39,17 +39,17 @@ class Pub : public FairMQDevice
auto r2 = Receive(ready2, "control"); auto r2 = Receive(ready2, "control");
if (r1 >= 0 && r2 >= 0) 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 msg = FairMQMessagePtr{NewMessage()};
auto d1 = Send(msg, "data"); auto d1 = Send(msg, "data");
if (d1 >= 0) if (d1 >= 0)
{ {
LOG(INFO) << "Sent data: d1 = " << d1; LOG(info) << "Sent data: d1 = " << d1;
} }
else else
{ {
LOG(ERROR) << "Failed sending data: d1 = " << d1; LOG(error) << "Failed sending data: d1 = " << d1;
} }
auto ack1 = FairMQMessagePtr{NewMessage()}; auto ack1 = FairMQMessagePtr{NewMessage()};
@ -58,16 +58,16 @@ class Pub : public FairMQDevice
auto a2 = Receive(ack2, "control"); auto a2 = Receive(ack2, "control");
if (a1 >= 0 && a2 >= 0) if (a1 >= 0 && a2 >= 0)
{ {
LOG(INFO) << "PUB-SUB test successfull"; LOG(info) << "PUB-SUB test successfull";
} }
else else
{ {
LOG(ERROR) << "Failed receiving ack signal: a1 = " << a1 << ", a2 = " << a2; LOG(error) << "Failed receiving ack signal: a1 = " << a1 << ", a2 = " << a2;
} }
} }
else else
{ {
LOG(ERROR) << "Failed receiving ready signal: r1 = " << r1 << ", r2 = " << r2; LOG(error) << "Failed receiving ready signal: r1 = " << r1 << ", r2 = " << r2;
} }
} }
}; };

View File

@ -37,7 +37,7 @@ class Pull : public FairMQDevice
if (Receive(msg, "data") >= 0) if (Receive(msg, "data") >= 0)
{ {
LOG(INFO) << "PUSH-PULL test successfull"; LOG(info) << "PUSH-PULL test successfull";
} }
}; };
}; };

View File

@ -34,19 +34,19 @@ class Rep : public FairMQDevice
auto request1 = FairMQMessagePtr{NewMessage()}; auto request1 = FairMQMessagePtr{NewMessage()};
if (Receive(request1, "data") >= 0) if (Receive(request1, "data") >= 0)
{ {
LOG(INFO) << "Received request 1"; LOG(info) << "Received request 1";
auto reply = FairMQMessagePtr{NewMessage()}; auto reply = FairMQMessagePtr{NewMessage()};
Send(reply, "data"); Send(reply, "data");
} }
auto request2 = FairMQMessagePtr{NewMessage()}; auto request2 = FairMQMessagePtr{NewMessage()};
if (Receive(request2, "data") >= 0) if (Receive(request2, "data") >= 0)
{ {
LOG(INFO) << "Received request 2"; LOG(info) << "Received request 2";
auto reply = FairMQMessagePtr{NewMessage()}; auto reply = FairMQMessagePtr{NewMessage()};
Send(reply, "data"); Send(reply, "data");
} }
LOG(INFO) << "REQ-REP test successfull"; LOG(info) << "REQ-REP test successfull";
}; };
}; };

View File

@ -37,7 +37,7 @@ class Req : public FairMQDevice
auto reply = FairMQMessagePtr{NewMessage()}; auto reply = FairMQMessagePtr{NewMessage()};
if (Receive(reply, "data") >= 0) if (Receive(reply, "data") >= 0)
{ {
LOG(INFO) << "received reply"; LOG(info) << "received reply";
} }
}; };
}; };

View File

@ -37,31 +37,31 @@ class Sub : public FairMQDevice
auto r1 = Send(ready, "control"); auto r1 = Send(ready, "control");
if (r1 >= 0) if (r1 >= 0)
{ {
LOG(INFO) << "Sent first control signal"; LOG(info) << "Sent first control signal";
auto msg = FairMQMessagePtr{NewMessage()}; auto msg = FairMQMessagePtr{NewMessage()};
auto d1 = Receive(msg, "data"); auto d1 = Receive(msg, "data");
if (d1 >= 0) if (d1 >= 0)
{ {
LOG(INFO) << "Received data"; LOG(info) << "Received data";
auto ack = FairMQMessagePtr{NewMessage()}; auto ack = FairMQMessagePtr{NewMessage()};
auto a1 = Send(ack, "control"); auto a1 = Send(ack, "control");
if (a1 >= 0) if (a1 >= 0)
{ {
LOG(INFO) << "Sent second control signal"; LOG(info) << "Sent second control signal";
} }
else else
{ {
LOG(ERROR) << "Failed sending ack signal: a1 = " << a1; LOG(error) << "Failed sending ack signal: a1 = " << a1;
} }
} }
else else
{ {
LOG(ERROR) << "Failed receiving data: d1 = " << d1; LOG(error) << "Failed receiving data: d1 = " << d1;
} }
} }
else else
{ {
LOG(ERROR) << "Failed sending ready signal: r1 = " << r1; LOG(error) << "Failed sending ready signal: r1 = " << r1;
} }
} }
}; };

View File

@ -29,27 +29,27 @@ class TransferTimeout : public FairMQDevice
if (Send(msg1, "data-out", 0, 100) == -2) if (Send(msg1, "data-out", 0, 100) == -2)
{ {
LOG(INFO) << "send canceled"; LOG(info) << "send canceled";
sendCanceling = true; sendCanceling = true;
} }
else else
{ {
LOG(ERROR) << "send did not cancel"; LOG(error) << "send did not cancel";
} }
if (Receive(msg2, "data-in", 0, 100) == -2) if (Receive(msg2, "data-in", 0, 100) == -2)
{ {
LOG(INFO) << "receive canceled"; LOG(info) << "receive canceled";
receiveCanceling = true; receiveCanceling = true;
} }
else else
{ {
LOG(ERROR) << "receive did not cancel"; LOG(error) << "receive did not cancel";
} }
if (sendCanceling && receiveCanceling) if (sendCanceling && receiveCanceling)
{ {
LOG(INFO) << "Transfer timeout test successfull"; LOG(info) << "Transfer timeout test successfull";
} }
}; };
}; };

View File

@ -83,7 +83,7 @@ inline std::string getInterfaceIP(std::string interface)
} }
else else
{ {
LOG(ERROR) << "Could not find provided network interface: \"" << interface << "\"!, exiting."; LOG(error) << "Could not find provided network interface: \"" << interface << "\"!, exiting.";
return ""; return "";
} }
} }
@ -102,7 +102,7 @@ inline std::string getDefaultRouteNetworkInterface()
if (!file) 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 ""; return "";
} }
@ -118,11 +118,11 @@ inline std::string getDefaultRouteNetworkInterface()
if (interfaceName == "") if (interfaceName == "")
{ {
LOG(ERROR) << "Could not detect default route network interface name"; LOG(error) << "Could not detect default route network interface name";
} }
else 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; return interfaceName;

View File

@ -30,7 +30,7 @@ FairMQMessageZMQ::FairMQMessageZMQ()
{ {
if (zmq_msg_init(fMsg.get()) != 0) 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) 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) 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. // Needs lifetime extension for the ZMQ region.
if (zmq_msg_init_size(fMsg.get(), size) != 0) 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); 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) // 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<zmq_msg_t>(); fMsg = fair::mq::tools::make_unique<zmq_msg_t>();
if (zmq_msg_init(fMsg.get()) != 0) 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<zmq_msg_t>(); fMsg = fair::mq::tools::make_unique<zmq_msg_t>();
if (zmq_msg_init_size(fMsg.get(), size) != 0) 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<zmq_msg_t>(); fMsg = fair::mq::tools::make_unique<zmq_msg_t>();
if (zmq_msg_init_data(fMsg.get(), data, size, ffn, hint) != 0) 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 else
{ {
LOG(ERROR) << "FairMQMessageZMQ::SetUsedSize: cannot set used size higher than original."; LOG(error) << "cannot set used size higher than original.";
return false; return false;
} }
} }
@ -185,7 +185,7 @@ void FairMQMessageZMQ::ApplyUsedSize()
}, },
fMsg.release()) != 0) 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. // Shares the message buffer between msg and this fMsg.
if (zmq_msg_copy(fMsg.get(), zMsg.GetMessage()) != 0) 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; return;
} }
@ -219,7 +219,7 @@ void FairMQMessageZMQ::Copy(const FairMQMessagePtr& msg)
// Shares the message buffer between msg and this fMsg. // Shares the message buffer between msg and this fMsg.
if (zmq_msg_copy(fMsg.get(), msgPtr->GetMessage()) != 0) 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; return;
} }
@ -237,7 +237,7 @@ void FairMQMessageZMQ::CloseMessage()
{ {
if (zmq_msg_close(fMsg.get()) != 0) 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 // reset the message object to allow reuse in Rebuild
fMsg.reset(nullptr); fMsg.reset(nullptr);
@ -246,7 +246,7 @@ void FairMQMessageZMQ::CloseMessage()
{ {
if (zmq_msg_close(fViewMsg.get()) != 0) 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 // reset the message object to allow reuse in Rebuild
fViewMsg.reset(nullptr); fViewMsg.reset(nullptr);

View File

@ -104,8 +104,8 @@ FairMQPollerZMQ::FairMQPollerZMQ(const unordered_map<string, vector<FairMQChanne
} }
catch (const std::out_of_range& oor) catch (const std::out_of_range& oor)
{ {
LOG(ERROR) << "zeromq: at least one of the provided channel keys for poller initialization is invalid"; LOG(error) << "at least one of the provided channel keys for poller initialization is invalid";
LOG(ERROR) << "zeromq: out of range error: " << oor.what() << '\n'; LOG(error) << "out of range error: " << oor.what() << '\n';
throw std::out_of_range("invalid channel during poller initialization"); throw std::out_of_range("invalid channel during poller initialization");
} }
} }
@ -149,7 +149,7 @@ void FairMQPollerZMQ::SetItemEvents(zmq_pollitem_t& item, const int type)
} }
else else
{ {
LOG(ERROR) << "zeromq: invalid poller configuration, exiting."; LOG(error) << "invalid poller configuration, exiting.";
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -160,12 +160,12 @@ void FairMQPollerZMQ::Poll(const int timeout)
{ {
if (errno == ETERM) if (errno == ETERM)
{ {
LOG(DEBUG) << "zeromq: polling exited, reason: " << zmq_strerror(errno); LOG(debug) << "polling exited, reason: " << zmq_strerror(errno);
} }
else else
{ {
LOG(ERROR) << "zeromq: polling failed, reason: " << zmq_strerror(errno); LOG(error) << "polling failed, reason: " << zmq_strerror(errno);
throw std::runtime_error("zeromq: polling failed"); throw std::runtime_error("polling failed");
} }
} }
} }
@ -203,8 +203,8 @@ bool FairMQPollerZMQ::CheckInput(const string channelKey, const int index)
} }
catch (const std::out_of_range& oor) catch (const std::out_of_range& oor)
{ {
LOG(ERROR) << "zeromq: invalid channel key: \"" << channelKey << "\""; LOG(error) << "invalid channel key: \"" << channelKey << "\"";
LOG(ERROR) << "zeromq: out of range error: " << oor.what() << '\n'; LOG(error) << "out of range error: " << oor.what() << '\n';
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -222,8 +222,8 @@ bool FairMQPollerZMQ::CheckOutput(const string channelKey, const int index)
} }
catch (const std::out_of_range& oor) catch (const std::out_of_range& oor)
{ {
LOG(ERROR) << "zeromq: invalid channel key: \"" << channelKey << "\""; LOG(error) << "invalid channel key: \"" << channelKey << "\"";
LOG(ERROR) << "zeromq: out of range error: " << oor.what() << '\n'; LOG(error) << "out of range error: " << oor.what() << '\n';
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }

View File

@ -38,13 +38,13 @@ FairMQSocketZMQ::FairMQSocketZMQ(const string& type, const string& name, const s
if (fSocket == nullptr) if (fSocket == nullptr)
{ {
LOG(ERROR) << "Failed creating socket " << fId << ", reason: " << zmq_strerror(errno); LOG(error) << "Failed creating socket " << fId << ", reason: " << zmq_strerror(errno);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (zmq_setsockopt(fSocket, ZMQ_IDENTITY, fId.c_str(), fId.length()) != 0) if (zmq_setsockopt(fSocket, ZMQ_IDENTITY, fId.c_str(), fId.length()) != 0)
{ {
LOG(ERROR) << "Failed setting ZMQ_IDENTITY socket option, reason: " << zmq_strerror(errno); LOG(error) << "Failed setting ZMQ_IDENTITY socket option, reason: " << zmq_strerror(errno);
} }
// Tell socket to try and send/receive outstanding messages for <linger> milliseconds before terminating. // Tell socket to try and send/receive outstanding messages for <linger> milliseconds before terminating.
@ -52,30 +52,30 @@ FairMQSocketZMQ::FairMQSocketZMQ(const string& type, const string& name, const s
int linger = 1000; int linger = 1000;
if (zmq_setsockopt(fSocket, ZMQ_LINGER, &linger, sizeof(linger)) != 0) 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; int sndTimeout = 700;
if (zmq_setsockopt(fSocket, ZMQ_SNDTIMEO, &sndTimeout, sizeof(sndTimeout)) != 0) 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; int rcvTimeout = 700;
if (zmq_setsockopt(fSocket, ZMQ_RCVTIMEO, &rcvTimeout, sizeof(rcvTimeout)) != 0) 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 (type == "sub")
{ {
if (zmq_setsockopt(fSocket, ZMQ_SUBSCRIBE, nullptr, 0) != 0) 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() string FairMQSocketZMQ::GetId()
@ -85,7 +85,7 @@ string FairMQSocketZMQ::GetId()
bool FairMQSocketZMQ::Bind(const string& address) 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) 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. // 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; 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 false;
} }
return true; return true;
@ -101,11 +101,11 @@ bool FairMQSocketZMQ::Bind(const string& address)
void FairMQSocketZMQ::Connect(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) 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. // error here means incorrect configuration. exit if it happens.
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -140,12 +140,12 @@ int FairMQSocketZMQ::Send(FairMQMessagePtr& msg, const int flags)
} }
else if (zmq_errno() == ETERM) else if (zmq_errno() == ETERM)
{ {
LOG(INFO) << "terminating socket " << fId; LOG(info) << "terminating socket " << fId;
return -1; return -1;
} }
else 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; return nbytes;
} }
} }
@ -177,12 +177,12 @@ int FairMQSocketZMQ::Receive(FairMQMessagePtr& msg, const int flags)
} }
else if (zmq_errno() == ETERM) else if (zmq_errno() == ETERM)
{ {
LOG(INFO) << "terminating socket " << fId; LOG(info) << "terminating socket " << fId;
return -1; return -1;
} }
else 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; return nbytes;
} }
} }
@ -233,10 +233,10 @@ int64_t FairMQSocketZMQ::Send(vector<FairMQMessagePtr>& msgVec, const int flags)
} }
if (zmq_errno() == ETERM) if (zmq_errno() == ETERM)
{ {
LOG(INFO) << "terminating socket " << fId; LOG(info) << "terminating socket " << fId;
return -1; 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; return nbytes;
} }
} }
@ -258,7 +258,7 @@ int64_t FairMQSocketZMQ::Send(vector<FairMQMessagePtr>& msgVec, const int flags)
} }
else // if the vector is empty, something might be wrong 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; return -1;
} }
} }
@ -321,7 +321,7 @@ int64_t FairMQSocketZMQ::Receive(vector<FairMQMessagePtr>& msgVec, const int fla
void FairMQSocketZMQ::Close() void FairMQSocketZMQ::Close()
{ {
// LOG(DEBUG) << "Closing socket " << fId; // LOG(debug) << "Closing socket " << fId;
if (fSocket == nullptr) if (fSocket == nullptr)
{ {
@ -330,7 +330,7 @@ void FairMQSocketZMQ::Close()
if (zmq_close(fSocket) != 0) 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; 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) 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) 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) 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; return false;
} }
if (zmq_setsockopt(fSocket, ZMQ_SNDTIMEO, &timeout, sizeof(int)) != 0) 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; return false;
} }
if (zmq_bind(fSocket, address.c_str()) != 0) 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; return false;
} }
} }
@ -417,23 +417,23 @@ bool FairMQSocketZMQ::SetSendTimeout(const int timeout, const string& address, c
{ {
if (zmq_disconnect(fSocket, address.c_str()) != 0) 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; return false;
} }
if (zmq_setsockopt(fSocket, ZMQ_SNDTIMEO, &timeout, sizeof(int)) != 0) 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; return false;
} }
if (zmq_connect(fSocket, address.c_str()) != 0) 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; return false;
} }
} }
else else
{ {
LOG(ERROR) << "SetSendTimeout() failed - unknown method provided!"; LOG(error) << "timeout failed - unknown method provided!";
return false; return false;
} }
@ -447,7 +447,7 @@ int FairMQSocketZMQ::GetSendTimeout() const
if (zmq_getsockopt(fSocket, ZMQ_SNDTIMEO, &timeout, &size) != 0) 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; return timeout;
@ -459,17 +459,17 @@ bool FairMQSocketZMQ::SetReceiveTimeout(const int timeout, const string& address
{ {
if (zmq_unbind(fSocket, address.c_str()) != 0) 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; return false;
} }
if (zmq_setsockopt(fSocket, ZMQ_RCVTIMEO, &timeout, sizeof(int)) != 0) 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; return false;
} }
if (zmq_bind(fSocket, address.c_str()) != 0) 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; return false;
} }
} }
@ -477,23 +477,23 @@ bool FairMQSocketZMQ::SetReceiveTimeout(const int timeout, const string& address
{ {
if (zmq_disconnect(fSocket, address.c_str()) != 0) 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; return false;
} }
if (zmq_setsockopt(fSocket, ZMQ_RCVTIMEO, &timeout, sizeof(int)) != 0) 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; return false;
} }
if (zmq_connect(fSocket, address.c_str()) != 0) 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; return false;
} }
} }
else else
{ {
LOG(ERROR) << "SetReceiveTimeout() failed - unknown method provided!"; LOG(error) << "timeout failed - unknown method provided!";
return false; return false;
} }
@ -507,7 +507,7 @@ int FairMQSocketZMQ::GetReceiveTimeout() const
if (zmq_getsockopt(fSocket, ZMQ_RCVTIMEO, &timeout, &size) != 0) 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; return timeout;

View File

@ -19,17 +19,17 @@ FairMQTransportFactoryZMQ::FairMQTransportFactoryZMQ(const string& id, const Fai
{ {
int major, minor, patch; int major, minor, patch;
zmq_version(&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) if (!fContext)
{ {
LOG(ERROR) << "failed creating context, reason: " << zmq_strerror(errno); LOG(error) << "failed creating context, reason: " << zmq_strerror(errno);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (zmq_ctx_set(fContext, ZMQ_MAX_SOCKETS, 10000) != 0) 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; int numIoThreads = 1;
@ -39,12 +39,12 @@ FairMQTransportFactoryZMQ::FairMQTransportFactoryZMQ(const string& id, const Fai
} }
else 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) 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) if (errno == EINTR)
{ {
LOG(ERROR) << " failed closing context, reason: " << zmq_strerror(errno); LOG(error) << " failed closing context, reason: " << zmq_strerror(errno);
} }
else else
{ {
@ -124,6 +124,6 @@ FairMQTransportFactoryZMQ::~FairMQTransportFactoryZMQ()
} }
else else
{ {
LOG(ERROR) << "Terminate(): context not available for shutdown"; LOG(error) << "context not available for shutdown";
} }
} }

View File

@ -30,6 +30,6 @@ size_t FairMQUnmanagedRegionZMQ::GetSize() const
FairMQUnmanagedRegionZMQ::~FairMQUnmanagedRegionZMQ() FairMQUnmanagedRegionZMQ::~FairMQUnmanagedRegionZMQ()
{ {
LOG(DEBUG) << "destroying region"; LOG(debug) << "destroying region";
free(fBuffer); free(fBuffer);
} }