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

@@ -30,7 +30,7 @@ FairMQMessageZMQ::FairMQMessageZMQ()
{
if (zmq_msg_init(fMsg.get()) != 0)
{
LOG(ERROR) << "failed initializing message, reason: " << zmq_strerror(errno);
LOG(error) << "failed initializing message, reason: " << zmq_strerror(errno);
}
}
@@ -42,7 +42,7 @@ FairMQMessageZMQ::FairMQMessageZMQ(const size_t size)
{
if (zmq_msg_init_size(fMsg.get(), size) != 0)
{
LOG(ERROR) << "failed initializing message with size, reason: " << zmq_strerror(errno);
LOG(error) << "failed initializing message with size, reason: " << zmq_strerror(errno);
}
}
@@ -54,7 +54,7 @@ FairMQMessageZMQ::FairMQMessageZMQ(void* data, const size_t size, fairmq_free_fn
{
if (zmq_msg_init_data(fMsg.get(), data, size, ffn, hint) != 0)
{
LOG(ERROR) << "failed initializing message with data, reason: " << zmq_strerror(errno);
LOG(error) << "failed initializing message with data, reason: " << zmq_strerror(errno);
}
}
@@ -69,7 +69,7 @@ FairMQMessageZMQ::FairMQMessageZMQ(FairMQUnmanagedRegionPtr& region, void* data,
// Needs lifetime extension for the ZMQ region.
if (zmq_msg_init_size(fMsg.get(), size) != 0)
{
LOG(ERROR) << "failed initializing message with size, reason: " << zmq_strerror(errno);
LOG(error) << "failed initializing message with size, reason: " << zmq_strerror(errno);
}
memcpy(zmq_msg_data(fMsg.get()), data, size);
@@ -78,7 +78,7 @@ FairMQMessageZMQ::FairMQMessageZMQ(FairMQUnmanagedRegionPtr& region, void* data,
// if (zmq_msg_init_data(fMsg.get(), data, size, [](void*, void*){}, nullptr) != 0)
// {
// LOG(ERROR) << "failed initializing message with data, reason: " << zmq_strerror(errno);
// LOG(error) << "failed initializing message with data, reason: " << zmq_strerror(errno);
// }
}
@@ -88,7 +88,7 @@ void FairMQMessageZMQ::Rebuild()
fMsg = fair::mq::tools::make_unique<zmq_msg_t>();
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>();
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>();
if (zmq_msg_init_data(fMsg.get(), data, size, ffn, hint) != 0)
{
LOG(ERROR) << "failed initializing message with data, reason: " << zmq_strerror(errno);
LOG(error) << "failed initializing message with data, reason: " << zmq_strerror(errno);
}
}
@@ -162,7 +162,7 @@ bool FairMQMessageZMQ::SetUsedSize(const size_t size)
}
else
{
LOG(ERROR) << "FairMQMessageZMQ::SetUsedSize: cannot set used size higher than original.";
LOG(error) << "cannot set used size higher than original.";
return false;
}
}
@@ -185,7 +185,7 @@ void FairMQMessageZMQ::ApplyUsedSize()
},
fMsg.release()) != 0)
{
LOG(ERROR) << "failed initializing view message, reason: " << zmq_strerror(errno);
LOG(error) << "failed initializing view message, reason: " << zmq_strerror(errno);
}
}
}
@@ -201,7 +201,7 @@ void FairMQMessageZMQ::Copy(const FairMQMessage& msg)
// Shares the message buffer between msg and this fMsg.
if (zmq_msg_copy(fMsg.get(), zMsg.GetMessage()) != 0)
{
LOG(ERROR) << "failed copying message, reason: " << zmq_strerror(errno);
LOG(error) << "failed copying message, reason: " << zmq_strerror(errno);
return;
}
@@ -219,7 +219,7 @@ void FairMQMessageZMQ::Copy(const FairMQMessagePtr& msg)
// Shares the message buffer between msg and this fMsg.
if (zmq_msg_copy(fMsg.get(), msgPtr->GetMessage()) != 0)
{
LOG(ERROR) << "failed copying message, reason: " << zmq_strerror(errno);
LOG(error) << "failed copying message, reason: " << zmq_strerror(errno);
return;
}
@@ -237,7 +237,7 @@ void FairMQMessageZMQ::CloseMessage()
{
if (zmq_msg_close(fMsg.get()) != 0)
{
LOG(ERROR) << "failed closing message, reason: " << zmq_strerror(errno);
LOG(error) << "failed closing message, reason: " << zmq_strerror(errno);
}
// reset the message object to allow reuse in Rebuild
fMsg.reset(nullptr);
@@ -246,7 +246,7 @@ void FairMQMessageZMQ::CloseMessage()
{
if (zmq_msg_close(fViewMsg.get()) != 0)
{
LOG(ERROR) << "failed closing message, reason: " << zmq_strerror(errno);
LOG(error) << "failed closing message, reason: " << zmq_strerror(errno);
}
// reset the message object to allow reuse in Rebuild
fViewMsg.reset(nullptr);

View File

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

View File

@@ -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;

View File

@@ -19,17 +19,17 @@ FairMQTransportFactoryZMQ::FairMQTransportFactoryZMQ(const string& id, const Fai
{
int major, minor, patch;
zmq_version(&major, &minor, &patch);
LOG(DEBUG) << "Transport: Using ZeroMQ library, version: " << major << "." << minor << "." << patch;
LOG(debug) << "Transport: Using ZeroMQ library, version: " << major << "." << minor << "." << patch;
if (!fContext)
{
LOG(ERROR) << "failed creating context, reason: " << zmq_strerror(errno);
LOG(error) << "failed creating context, reason: " << zmq_strerror(errno);
exit(EXIT_FAILURE);
}
if (zmq_ctx_set(fContext, ZMQ_MAX_SOCKETS, 10000) != 0)
{
LOG(ERROR) << "failed configuring context, reason: " << zmq_strerror(errno);
LOG(error) << "failed configuring context, reason: " << zmq_strerror(errno);
}
int numIoThreads = 1;
@@ -39,12 +39,12 @@ FairMQTransportFactoryZMQ::FairMQTransportFactoryZMQ(const string& id, const Fai
}
else
{
LOG(WARN) << "zeromq: FairMQProgOptions not available! Using defaults.";
LOG(warn) << "FairMQProgOptions not available! Using defaults.";
}
if (zmq_ctx_set(fContext, ZMQ_IO_THREADS, numIoThreads) != 0)
{
LOG(ERROR) << "failed configuring context, reason: " << zmq_strerror(errno);
LOG(error) << "failed configuring context, reason: " << zmq_strerror(errno);
}
}
@@ -113,7 +113,7 @@ FairMQTransportFactoryZMQ::~FairMQTransportFactoryZMQ()
{
if (errno == EINTR)
{
LOG(ERROR) << " failed closing context, reason: " << zmq_strerror(errno);
LOG(error) << " failed closing context, reason: " << zmq_strerror(errno);
}
else
{
@@ -124,6 +124,6 @@ FairMQTransportFactoryZMQ::~FairMQTransportFactoryZMQ()
}
else
{
LOG(ERROR) << "Terminate(): context not available for shutdown";
LOG(error) << "context not available for shutdown";
}
}

View File

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