mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 09:31:45 +00:00
convert log severities use to lowercase and remove use of MQLOG
This commit is contained in:
committed by
Mohammad Al-Turany
parent
4e942e489b
commit
a3393e600e
@@ -38,13 +38,13 @@ FairMQSocketZMQ::FairMQSocketZMQ(const string& type, const string& name, const s
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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.
|
||||
@@ -52,30 +52,30 @@ FairMQSocketZMQ::FairMQSocketZMQ(const string& type, const string& name, const s
|
||||
int linger = 1000;
|
||||
if (zmq_setsockopt(fSocket, ZMQ_LINGER, &linger, sizeof(linger)) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed setting ZMQ_LINGER socket option, reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed setting ZMQ_LINGER socket option, reason: " << zmq_strerror(errno);
|
||||
}
|
||||
|
||||
int sndTimeout = 700;
|
||||
if (zmq_setsockopt(fSocket, ZMQ_SNDTIMEO, &sndTimeout, sizeof(sndTimeout)) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed setting ZMQ_SNDTIMEO socket option, reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed setting ZMQ_SNDTIMEO socket option, reason: " << zmq_strerror(errno);
|
||||
}
|
||||
|
||||
int rcvTimeout = 700;
|
||||
if (zmq_setsockopt(fSocket, ZMQ_RCVTIMEO, &rcvTimeout, sizeof(rcvTimeout)) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed setting ZMQ_RCVTIMEO socket option, reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed setting ZMQ_RCVTIMEO socket option, reason: " << zmq_strerror(errno);
|
||||
}
|
||||
|
||||
if (type == "sub")
|
||||
{
|
||||
if (zmq_setsockopt(fSocket, ZMQ_SUBSCRIBE, nullptr, 0) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed setting ZMQ_SUBSCRIBE socket option, reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed setting ZMQ_SUBSCRIBE socket option, reason: " << zmq_strerror(errno);
|
||||
}
|
||||
}
|
||||
|
||||
// LOG(INFO) << "created socket " << fId;
|
||||
// LOG(info) << "created socket " << fId;
|
||||
}
|
||||
|
||||
string FairMQSocketZMQ::GetId()
|
||||
@@ -85,7 +85,7 @@ string FairMQSocketZMQ::GetId()
|
||||
|
||||
bool FairMQSocketZMQ::Bind(const string& address)
|
||||
{
|
||||
// LOG(INFO) << "bind socket " << fId << " on " << address;
|
||||
// LOG(info) << "bind socket " << fId << " on " << address;
|
||||
|
||||
if (zmq_bind(fSocket, address.c_str()) != 0)
|
||||
{
|
||||
@@ -93,7 +93,7 @@ bool FairMQSocketZMQ::Bind(const string& address)
|
||||
// do not print error in this case, this is handled by FairMQDevice in case no connection could be established after trying a number of random ports from a range.
|
||||
return false;
|
||||
}
|
||||
LOG(ERROR) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -101,11 +101,11 @@ bool FairMQSocketZMQ::Bind(const string& address)
|
||||
|
||||
void FairMQSocketZMQ::Connect(const string& address)
|
||||
{
|
||||
// LOG(INFO) << "connect socket " << fId << " on " << address;
|
||||
// LOG(info) << "connect socket " << fId << " on " << address;
|
||||
|
||||
if (zmq_connect(fSocket, address.c_str()) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
// error here means incorrect configuration. exit if it happens.
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -140,12 +140,12 @@ int FairMQSocketZMQ::Send(FairMQMessagePtr& msg, const int flags)
|
||||
}
|
||||
else if (zmq_errno() == ETERM)
|
||||
{
|
||||
LOG(INFO) << "terminating socket " << fId;
|
||||
LOG(info) << "terminating socket " << fId;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(ERROR) << "Failed sending on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed sending on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return nbytes;
|
||||
}
|
||||
}
|
||||
@@ -177,12 +177,12 @@ int FairMQSocketZMQ::Receive(FairMQMessagePtr& msg, const int flags)
|
||||
}
|
||||
else if (zmq_errno() == ETERM)
|
||||
{
|
||||
LOG(INFO) << "terminating socket " << fId;
|
||||
LOG(info) << "terminating socket " << fId;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(ERROR) << "Failed receiving on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed receiving on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return nbytes;
|
||||
}
|
||||
}
|
||||
@@ -233,10 +233,10 @@ int64_t FairMQSocketZMQ::Send(vector<FairMQMessagePtr>& msgVec, const int flags)
|
||||
}
|
||||
if (zmq_errno() == ETERM)
|
||||
{
|
||||
LOG(INFO) << "terminating socket " << fId;
|
||||
LOG(info) << "terminating socket " << fId;
|
||||
return -1;
|
||||
}
|
||||
LOG(ERROR) << "Failed sending on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed sending on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return nbytes;
|
||||
}
|
||||
}
|
||||
@@ -258,7 +258,7 @@ int64_t FairMQSocketZMQ::Send(vector<FairMQMessagePtr>& msgVec, const int flags)
|
||||
}
|
||||
else // if the vector is empty, something might be wrong
|
||||
{
|
||||
LOG(WARN) << "Will not send empty vector";
|
||||
LOG(warn) << "Will not send empty vector";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -321,7 +321,7 @@ int64_t FairMQSocketZMQ::Receive(vector<FairMQMessagePtr>& msgVec, const int fla
|
||||
|
||||
void FairMQSocketZMQ::Close()
|
||||
{
|
||||
// LOG(DEBUG) << "Closing socket " << fId;
|
||||
// LOG(debug) << "Closing socket " << fId;
|
||||
|
||||
if (fSocket == nullptr)
|
||||
{
|
||||
@@ -330,7 +330,7 @@ void FairMQSocketZMQ::Close()
|
||||
|
||||
if (zmq_close(fSocket) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed closing socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed closing socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
}
|
||||
|
||||
fSocket = nullptr;
|
||||
@@ -361,7 +361,7 @@ void FairMQSocketZMQ::SetOption(const string& option, const void* value, size_t
|
||||
{
|
||||
if (zmq_setsockopt(fSocket, GetConstant(option), value, valueSize) < 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed setting socket option, reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed setting socket option, reason: " << zmq_strerror(errno);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ void FairMQSocketZMQ::GetOption(const string& option, void* value, size_t* value
|
||||
{
|
||||
if (zmq_getsockopt(fSocket, GetConstant(option), value, valueSize) < 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed getting socket option, reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed getting socket option, reason: " << zmq_strerror(errno);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,17 +399,17 @@ bool FairMQSocketZMQ::SetSendTimeout(const int timeout, const string& address, c
|
||||
{
|
||||
if (zmq_unbind(fSocket, address.c_str()) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed unbinding socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed unbinding socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
if (zmq_setsockopt(fSocket, ZMQ_SNDTIMEO, &timeout, sizeof(int)) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
if (zmq_bind(fSocket, address.c_str()) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -417,23 +417,23 @@ bool FairMQSocketZMQ::SetSendTimeout(const int timeout, const string& address, c
|
||||
{
|
||||
if (zmq_disconnect(fSocket, address.c_str()) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed disconnecting socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed disconnecting socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
if (zmq_setsockopt(fSocket, ZMQ_SNDTIMEO, &timeout, sizeof(int)) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
if (zmq_connect(fSocket, address.c_str()) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(ERROR) << "SetSendTimeout() failed - unknown method provided!";
|
||||
LOG(error) << "timeout failed - unknown method provided!";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ int FairMQSocketZMQ::GetSendTimeout() const
|
||||
|
||||
if (zmq_getsockopt(fSocket, ZMQ_SNDTIMEO, &timeout, &size) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed getting option 'receive timeout' on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed getting option 'receive timeout' on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
}
|
||||
|
||||
return timeout;
|
||||
@@ -459,17 +459,17 @@ bool FairMQSocketZMQ::SetReceiveTimeout(const int timeout, const string& address
|
||||
{
|
||||
if (zmq_unbind(fSocket, address.c_str()) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed unbinding socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed unbinding socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
if (zmq_setsockopt(fSocket, ZMQ_RCVTIMEO, &timeout, sizeof(int)) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
if (zmq_bind(fSocket, address.c_str()) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed binding socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -477,23 +477,23 @@ bool FairMQSocketZMQ::SetReceiveTimeout(const int timeout, const string& address
|
||||
{
|
||||
if (zmq_disconnect(fSocket, address.c_str()) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed disconnecting socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed disconnecting socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
if (zmq_setsockopt(fSocket, ZMQ_RCVTIMEO, &timeout, sizeof(int)) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed setting option on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
if (zmq_connect(fSocket, address.c_str()) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed connecting socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(ERROR) << "SetReceiveTimeout() failed - unknown method provided!";
|
||||
LOG(error) << "timeout failed - unknown method provided!";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -507,7 +507,7 @@ int FairMQSocketZMQ::GetReceiveTimeout() const
|
||||
|
||||
if (zmq_getsockopt(fSocket, ZMQ_RCVTIMEO, &timeout, &size) != 0)
|
||||
{
|
||||
LOG(ERROR) << "Failed getting option 'receive timeout' on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
LOG(error) << "Failed getting option 'receive timeout' on socket " << fId << ", reason: " << zmq_strerror(errno);
|
||||
}
|
||||
|
||||
return timeout;
|
||||
|
Reference in New Issue
Block a user