diff --git a/iceoryx_binding_c/source/c2cpp_enum_translation.cpp b/iceoryx_binding_c/source/c2cpp_enum_translation.cpp index 893c978089f..43a8c7b0e50 100644 --- a/iceoryx_binding_c/source/c2cpp_enum_translation.cpp +++ b/iceoryx_binding_c/source/c2cpp_enum_translation.cpp @@ -58,7 +58,7 @@ iox::popo::SubscriberEvent subscriberEvent(const iox_SubscriberEvent value) noex return iox::popo::SubscriberEvent::DATA_RECEIVED; } - IOX_LOG(FATAL) << "invalid iox_SubscriberEvent value"; + IOX_LOG(FATAL, "invalid iox_SubscriberEvent value"); errorHandler(iox::CBindingError::BINDING_C__C2CPP_ENUM_TRANSLATION_INVALID_SUBSCRIBER_EVENT_VALUE); return iox::popo::SubscriberEvent::DATA_RECEIVED; } @@ -71,7 +71,7 @@ iox::popo::SubscriberState subscriberState(const iox_SubscriberState value) noex return iox::popo::SubscriberState::HAS_DATA; } - IOX_LOG(FATAL) << "invalid iox_SubscriberState value"; + IOX_LOG(FATAL, "invalid iox_SubscriberState value"); errorHandler(iox::CBindingError::BINDING_C__C2CPP_ENUM_TRANSLATION_INVALID_SUBSCRIBER_STATE_VALUE); return iox::popo::SubscriberState::HAS_DATA; } @@ -84,7 +84,7 @@ iox::popo::ClientEvent clientEvent(const iox_ClientEvent value) noexcept return iox::popo::ClientEvent::RESPONSE_RECEIVED; } - IOX_LOG(FATAL) << "invalid iox_ClientEvent value"; + IOX_LOG(FATAL, "invalid iox_ClientEvent value"); errorHandler(iox::CBindingError::BINDING_C__C2CPP_ENUM_TRANSLATION_INVALID_CLIENT_EVENT_VALUE); return iox::popo::ClientEvent::RESPONSE_RECEIVED; } @@ -97,7 +97,7 @@ iox::popo::ClientState clientState(const iox_ClientState value) noexcept return iox::popo::ClientState::HAS_RESPONSE; } - IOX_LOG(FATAL) << "invalid iox_ClientState value"; + IOX_LOG(FATAL, "invalid iox_ClientState value"); errorHandler(iox::CBindingError::BINDING_C__C2CPP_ENUM_TRANSLATION_INVALID_CLIENT_STATE_VALUE); return iox::popo::ClientState::HAS_RESPONSE; } @@ -110,7 +110,7 @@ iox::popo::ServerEvent serverEvent(const iox_ServerEvent value) noexcept return iox::popo::ServerEvent::REQUEST_RECEIVED; } - IOX_LOG(FATAL) << "invalid iox_ServerEvent value"; + IOX_LOG(FATAL, "invalid iox_ServerEvent value"); errorHandler(iox::CBindingError::BINDING_C__C2CPP_ENUM_TRANSLATION_INVALID_SERVER_EVENT_VALUE); return iox::popo::ServerEvent::REQUEST_RECEIVED; } @@ -123,7 +123,7 @@ iox::popo::ServerState serverState(const iox_ServerState value) noexcept return iox::popo::ServerState::HAS_REQUEST; } - IOX_LOG(FATAL) << "invalid iox_ServerState value"; + IOX_LOG(FATAL, "invalid iox_ServerState value"); errorHandler(iox::CBindingError::BINDING_C__C2CPP_ENUM_TRANSLATION_INVALID_SERVER_STATE_VALUE); return iox::popo::ServerState::HAS_REQUEST; } @@ -136,7 +136,7 @@ iox::runtime::ServiceDiscoveryEvent serviceDiscoveryEvent(const iox_ServiceDisco return iox::runtime::ServiceDiscoveryEvent::SERVICE_REGISTRY_CHANGED; } - IOX_LOG(FATAL) << "invalid iox_ServiceDiscoveryEvent value"; + IOX_LOG(FATAL, "invalid iox_ServiceDiscoveryEvent value"); errorHandler(iox::CBindingError::BINDING_C__C2CPP_ENUM_TRANSLATION_INVALID_SERVICE_DISCOVERY_EVENT_VALUE); return iox::runtime::ServiceDiscoveryEvent::SERVICE_REGISTRY_CHANGED; } @@ -151,7 +151,7 @@ iox::popo::MessagingPattern messagingPattern(const iox_MessagingPattern value) n return iox::popo::MessagingPattern::REQ_RES; } - IOX_LOG(FATAL) << "invalid iox_MessagingPattern value"; + IOX_LOG(FATAL, "invalid iox_MessagingPattern value"); errorHandler(iox::CBindingError::BINDING_C__C2CPP_ENUM_TRANSLATION_INVALID_MESSAGING_PATTERN_VALUE); return iox::popo::MessagingPattern::PUB_SUB; } diff --git a/iceoryx_binding_c/source/c_publisher.cpp b/iceoryx_binding_c/source/c_publisher.cpp index 8a3af1e767e..63b52d14567 100644 --- a/iceoryx_binding_c/source/c_publisher.cpp +++ b/iceoryx_binding_c/source/c_publisher.cpp @@ -42,7 +42,7 @@ void iox_pub_options_init(iox_pub_options_t* options) { if (options == nullptr) { - IOX_LOG(WARN) << "publisher options initialization skipped - null pointer provided"; + IOX_LOG(WARN, "publisher options initialization skipped - null pointer provided"); return; } @@ -68,7 +68,7 @@ iox_pub_t iox_pub_init(iox_pub_storage_t* self, { if (self == nullptr) { - IOX_LOG(WARN) << "publisher initialization skipped - null pointer provided for iox_pub_storage_t"; + IOX_LOG(WARN, "publisher initialization skipped - null pointer provided for iox_pub_storage_t"); return nullptr; } @@ -81,7 +81,7 @@ iox_pub_t iox_pub_init(iox_pub_storage_t* self, { // note that they may have been initialized but the initCheck // pattern overwritten afterwards, we cannot be sure but it is a misuse - IOX_LOG(FATAL) << "publisher options may not have been initialized with iox_pub_options_init"; + IOX_LOG(FATAL, "publisher options may not have been initialized with iox_pub_options_init"); errorHandler(CBindingError::BINDING_C__PUBLISHER_OPTIONS_NOT_INITIALIZED); } publisherOptions.historyCapacity = options->historyCapacity; diff --git a/iceoryx_binding_c/source/c_subscriber.cpp b/iceoryx_binding_c/source/c_subscriber.cpp index 14edc5a7d5c..9fe2c79b0b6 100644 --- a/iceoryx_binding_c/source/c_subscriber.cpp +++ b/iceoryx_binding_c/source/c_subscriber.cpp @@ -51,7 +51,7 @@ void iox_sub_options_init(iox_sub_options_t* options) { if (options == nullptr) { - IOX_LOG(WARN) << "subscriber options initialization skipped - null pointer provided"; + IOX_LOG(WARN, "subscriber options initialization skipped - null pointer provided"); return; } @@ -79,7 +79,7 @@ iox_sub_t iox_sub_init(iox_sub_storage_t* self, { if (self == nullptr) { - IOX_LOG(WARN) << "subscriber initialization skipped - null pointer provided for iox_sub_storage_t"; + IOX_LOG(WARN, "subscriber initialization skipped - null pointer provided for iox_sub_storage_t"); return nullptr; } @@ -92,7 +92,7 @@ iox_sub_t iox_sub_init(iox_sub_storage_t* self, { // note that they may have been initialized but the initCheck // pattern overwritten afterwards, we cannot be sure but it is a misuse - IOX_LOG(FATAL) << "subscriber options may not have been initialized with iox_sub_init"; + IOX_LOG(FATAL, "subscriber options may not have been initialized with iox_sub_init"); errorHandler(CBindingError::BINDING_C__SUBSCRIBER_OPTIONS_NOT_INITIALIZED); } subscriberOptions.queueCapacity = options->queueCapacity; diff --git a/iceoryx_binding_c/source/c_user_trigger.cpp b/iceoryx_binding_c/source/c_user_trigger.cpp index bf7d1e35a04..310297be13d 100644 --- a/iceoryx_binding_c/source/c_user_trigger.cpp +++ b/iceoryx_binding_c/source/c_user_trigger.cpp @@ -30,7 +30,7 @@ iox_user_trigger_t iox_user_trigger_init(iox_user_trigger_storage_t* self) { if (self == nullptr) { - IOX_LOG(WARN) << "user trigger initialization skipped - null pointer provided for iox_user_trigger_storage_t"; + IOX_LOG(WARN, "user trigger initialization skipped - null pointer provided for iox_user_trigger_storage_t"); return nullptr; } auto* me = new UserTrigger(); diff --git a/iceoryx_dust/include/iceoryx_dust/cxx/serialization.hpp b/iceoryx_dust/include/iceoryx_dust/cxx/serialization.hpp index 2100f8e2878..556053b45e2 100644 --- a/iceoryx_dust/include/iceoryx_dust/cxx/serialization.hpp +++ b/iceoryx_dust/include/iceoryx_dust/cxx/serialization.hpp @@ -34,7 +34,7 @@ namespace cxx /// 5:hello3:1236:123.01 /// @code /// auto serial = cxx::Serialization::create("fuu", 123, 12.12f, 'c'); -/// IOX_LOG(INFO) << serial.toString(); +/// IOX_LOG(INFO, serial.toString()); /// /// std::string v1; /// int v2; diff --git a/iceoryx_dust/include/iceoryx_dust/internal/cxx/convert.inl b/iceoryx_dust/include/iceoryx_dust/internal/cxx/convert.inl index cf0e2c05b7c..5ca749d3823 100644 --- a/iceoryx_dust/include/iceoryx_dust/internal/cxx/convert.inl +++ b/iceoryx_dust/include/iceoryx_dust/internal/cxx/convert.inl @@ -70,7 +70,7 @@ inline bool convert::fromString(const char* v, char& dest) noexcept { if (strlen(v) != 1U) { - IOX_LOG(DEBUG) << v << " is not a char"; + IOX_LOG(DEBUG, v << " is not a char"); return false; } @@ -133,22 +133,22 @@ inline bool convert::stringIsNumberWithErrorMessage(const char* v, const NumberT { if (!stringIsNumber(v, type)) { - IOX_LOG(DEBUG) << v << " is not "; + IOX_LOG(DEBUG, v << " is not "); switch (type) { case NumberType::FLOAT: { - IOX_LOG(DEBUG) << "a float"; + IOX_LOG(DEBUG, "a float"); break; } case NumberType::INTEGER: { - IOX_LOG(DEBUG) << "a signed integer"; + IOX_LOG(DEBUG, "a signed integer"); break; } case NumberType::UNSIGNED_INTEGER: { - IOX_LOG(DEBUG) << "an unsigned integer"; + IOX_LOG(DEBUG, "an unsigned integer"); break; } } @@ -219,7 +219,7 @@ inline bool convert::fromString(const char* v, uint64_t& dest) noexcep if (call->value > std::numeric_limits::max()) { - IOX_LOG(DEBUG) << call->value << " too large, uint64_t overflow"; + IOX_LOG(DEBUG, call->value << " too large, uint64_t overflow"); return false; } @@ -270,7 +270,7 @@ inline bool convert::fromString(const char* v, uint32_t& dest) noexcep if (call->value > std::numeric_limits::max()) { - IOX_LOG(DEBUG) << call->value << " too large, uint32_t overflow"; + IOX_LOG(DEBUG, call->value << " too large, uint32_t overflow"); return false; } @@ -295,7 +295,7 @@ inline bool convert::fromString(const char* v, uint16_t& dest) noexcep if (call->value > std::numeric_limits::max()) { - IOX_LOG(DEBUG) << call->value << " too large, uint16_t overflow"; + IOX_LOG(DEBUG, call->value << " too large, uint16_t overflow"); return false; } @@ -320,7 +320,7 @@ inline bool convert::fromString(const char* v, uint8_t& dest) noexcept if (call->value > std::numeric_limits::max()) { - IOX_LOG(DEBUG) << call->value << " too large, uint8_t overflow"; + IOX_LOG(DEBUG, call->value << " too large, uint8_t overflow"); return false; } @@ -345,7 +345,7 @@ inline bool convert::fromString(const char* v, int64_t& dest) noexcept if (call->value > std::numeric_limits::max() || call->value < std::numeric_limits::min()) { - IOX_LOG(DEBUG) << call->value << " is out of range, int64_t overflow"; + IOX_LOG(DEBUG, call->value << " is out of range, int64_t overflow"); return false; } @@ -370,7 +370,7 @@ inline bool convert::fromString(const char* v, int32_t& dest) noexcept if (call->value > std::numeric_limits::max() || call->value < std::numeric_limits::min()) { - IOX_LOG(DEBUG) << call->value << " is out of range, int32_t overflow"; + IOX_LOG(DEBUG, call->value << " is out of range, int32_t overflow"); return false; } @@ -394,7 +394,7 @@ inline bool convert::fromString(const char* v, int16_t& dest) noexcept if (call->value > std::numeric_limits::max() || call->value < std::numeric_limits::min()) { - IOX_LOG(DEBUG) << call->value << " is out of range, int16_t overflow"; + IOX_LOG(DEBUG, call->value << " is out of range, int16_t overflow"); return false; } @@ -418,7 +418,7 @@ inline bool convert::fromString(const char* v, int8_t& dest) noexcept if (call->value > std::numeric_limits::max() || call->value < std::numeric_limits::min()) { - IOX_LOG(DEBUG) << call->value << " is out of range, int8_t overflow"; + IOX_LOG(DEBUG, call->value << " is out of range, int8_t overflow"); return false; } diff --git a/iceoryx_dust/include/iceoryx_dust/internal/cxx/forward_list.inl b/iceoryx_dust/include/iceoryx_dust/internal/cxx/forward_list.inl index 502344045cc..8d43804a6f2 100644 --- a/iceoryx_dust/include/iceoryx_dust/internal/cxx/forward_list.inl +++ b/iceoryx_dust/include/iceoryx_dust/internal/cxx/forward_list.inl @@ -234,7 +234,7 @@ forward_list::emplace_after(const_iterator iter, ConstructorArgs&&. if (m_size >= Capacity) { - IOX_LOG(DEBUG) << "capacity exhausted"; + IOX_LOG(DEBUG, "capacity exhausted"); return end(); } @@ -272,7 +272,7 @@ inline typename forward_list::iterator forward_list::e // additional validity check on to-be-erase element if (!isValidElementIdx(eraseIdx) || empty()) { - IOX_LOG(DEBUG) << "iterator is end() or list is empty"; + IOX_LOG(DEBUG, "iterator is end() or list is empty"); return end(); } diff --git a/iceoryx_dust/source/cxx/file_reader.cpp b/iceoryx_dust/source/cxx/file_reader.cpp index 5478c6580c3..0ca5e9d2842 100644 --- a/iceoryx_dust/source/cxx/file_reader.cpp +++ b/iceoryx_dust/source/cxx/file_reader.cpp @@ -48,13 +48,13 @@ FileReader::FileReader(const std::string& fileName, const std::string& filePath, } case ErrorMode::Inform: { - IOX_LOG(ERROR) << "Could not open file '" << fileName << "' from path '" << filePath << "'."; + IOX_LOG(ERROR, "Could not open file '" << fileName << "' from path '" << filePath << "'."); return; } case ErrorMode::Terminate: { m_fileStream.close(); - IOX_LOG(FATAL) << "Could not open file '" << fileName << "' from path '" << filePath << "'. Exiting!"; + IOX_LOG(FATAL, "Could not open file '" << fileName << "' from path '" << filePath << "'. Exiting!"); cxx::Ensures(false); return; } diff --git a/iceoryx_dust/source/posix_wrapper/message_queue.cpp b/iceoryx_dust/source/posix_wrapper/message_queue.cpp index c5b842b5c19..4692ae177b5 100644 --- a/iceoryx_dust/source/posix_wrapper/message_queue.cpp +++ b/iceoryx_dust/source/posix_wrapper/message_queue.cpp @@ -54,7 +54,7 @@ expected MessageQueueBuilder::create() const noex .and_then([&sanitizedName](auto& r) { if (r.errnum != ENOENT) { - IOX_LOG(DEBUG) << "MQ still there, doing an unlink of '" << sanitizedName << "'"; + IOX_LOG(DEBUG, "MQ still there, doing an unlink of '" << sanitizedName << "'"); } }); } @@ -100,7 +100,7 @@ MessageQueue::~MessageQueue() noexcept { if (destroy().has_error()) { - IOX_LOG(ERROR) << "unable to cleanup message queue '" << m_name << "' in the destructor"; + IOX_LOG(ERROR, "unable to cleanup message queue '" << m_name << "' in the destructor"); } } @@ -110,8 +110,9 @@ MessageQueue& MessageQueue::operator=(MessageQueue&& other) noexcept { if (destroy().has_error()) { - IOX_LOG(ERROR) << "unable to cleanup message queue '" << m_name - << "' during move operation - resource leaks are possible!"; + IOX_LOG(ERROR, + "unable to cleanup message queue '" << m_name + << "' during move operation - resource leaks are possible!"); } m_name = std::move(other.m_name); @@ -302,8 +303,8 @@ expected MessageQueue::timedSend(const std::string& msg, const uint64_t messageSize = msg.size() + NULL_TERMINATOR_SIZE; if (messageSize > static_cast(m_attributes.mq_msgsize)) { - IOX_LOG(ERROR) << "the message '" << msg << "' which should be sent to the message queue '" << m_name - << "' is too long"; + IOX_LOG(ERROR, + "the message '" << msg << "' which should be sent to the message queue '" << m_name << "' is too long"); return err(IpcChannelError::MESSAGE_TOO_LONG); } @@ -344,12 +345,12 @@ IpcChannelError MessageQueue::errnoToEnum(const IpcChannelName_t& name, const in { case EACCES: { - IOX_LOG(ERROR) << "access denied to message queue '" << name << "'"; + IOX_LOG(ERROR, "access denied to message queue '" << name << "'"); return IpcChannelError::ACCESS_DENIED; } case EAGAIN: { - IOX_LOG(ERROR) << "the message queue '" << name << "' is full"; + IOX_LOG(ERROR, "the message queue '" << name << "' is full"); return IpcChannelError::CHANNEL_FULL; } case ETIMEDOUT: @@ -359,12 +360,12 @@ IpcChannelError MessageQueue::errnoToEnum(const IpcChannelName_t& name, const in } case EEXIST: { - IOX_LOG(ERROR) << "message queue '" << name << "' already exists"; + IOX_LOG(ERROR, "message queue '" << name << "' already exists"); return IpcChannelError::CHANNEL_ALREADY_EXISTS; } case EINVAL: { - IOX_LOG(ERROR) << "provided invalid arguments for message queue '" << name << "'"; + IOX_LOG(ERROR, "provided invalid arguments for message queue '" << name << "'"); return IpcChannelError::INVALID_ARGUMENTS; } case ENOENT: @@ -374,12 +375,12 @@ IpcChannelError MessageQueue::errnoToEnum(const IpcChannelName_t& name, const in } case ENAMETOOLONG: { - IOX_LOG(ERROR) << "message queue name '" << name << "' is too long"; + IOX_LOG(ERROR, "message queue name '" << name << "' is too long"); return IpcChannelError::INVALID_CHANNEL_NAME; } default: { - IOX_LOG(ERROR) << "internal logic error in message queue '" << name << "' occurred"; + IOX_LOG(ERROR, "internal logic error in message queue '" << name << "' occurred"); return IpcChannelError::INTERNAL_LOGIC_ERROR; } } diff --git a/iceoryx_dust/source/posix_wrapper/named_pipe.cpp b/iceoryx_dust/source/posix_wrapper/named_pipe.cpp index 8e9a7c78c67..d306937b387 100644 --- a/iceoryx_dust/source/posix_wrapper/named_pipe.cpp +++ b/iceoryx_dust/source/posix_wrapper/named_pipe.cpp @@ -40,8 +40,9 @@ expected NamedPipeBuilder::create() const noexcept { if (m_name.size() + strlen(&NamedPipe::NAMED_PIPE_PREFIX[0]) > NamedPipe::MAX_MESSAGE_SIZE) { - IOX_LOG(ERROR) << "The named pipe name: '" << m_name << "' is too long. Maxium name length is: " - << NamedPipe::MAX_MESSAGE_SIZE - strlen(&NamedPipe::NAMED_PIPE_PREFIX[0]); + IOX_LOG(ERROR, + "The named pipe name: '" << m_name << "' is too long. Maxium name length is: " + << NamedPipe::MAX_MESSAGE_SIZE - strlen(&NamedPipe::NAMED_PIPE_PREFIX[0])); return err(IpcChannelError::INVALID_CHANNEL_NAME); } @@ -52,22 +53,24 @@ expected NamedPipeBuilder::create() const noexcept || (!m_name.empty() && m_name.c_str()[0] == '/' && isValidFileName(*m_name.substr(1))); if (!isValidPipeName) { - IOX_LOG(ERROR) << "The named pipe name: '" << m_name << "' is not a valid file path name."; + IOX_LOG(ERROR, "The named pipe name: '" << m_name << "' is not a valid file path name."); return err(IpcChannelError::INVALID_CHANNEL_NAME); } if (m_maxMsgSize > NamedPipe::MAX_MESSAGE_SIZE) { - IOX_LOG(ERROR) << "A message size of " << m_maxMsgSize - << " exceeds the maximum message size for named pipes of " << NamedPipe::MAX_MESSAGE_SIZE; + IOX_LOG(ERROR, + "A message size of " << m_maxMsgSize << " exceeds the maximum message size for named pipes of " + << NamedPipe::MAX_MESSAGE_SIZE); return err(IpcChannelError::MAX_MESSAGE_SIZE_EXCEEDED); } if (m_maxMsgNumber > NamedPipe::MAX_NUMBER_OF_MESSAGES) { - IOX_LOG(ERROR) << "A message amount of " << m_maxMsgNumber - << " exceeds the maximum number of messages for named pipes of " - << NamedPipe::MAX_NUMBER_OF_MESSAGES; + IOX_LOG(ERROR, + "A message amount of " << m_maxMsgNumber + << " exceeds the maximum number of messages for named pipes of " + << NamedPipe::MAX_NUMBER_OF_MESSAGES); return err(IpcChannelError::MAX_MESSAGE_SIZE_EXCEEDED); } @@ -83,8 +86,7 @@ expected NamedPipeBuilder::create() const noexcept if (sharedMemoryResult.has_error()) { - IOX_LOG(ERROR) << "Unable to open shared memory: '" << namedPipeShmName << "' for named pipe '" << m_name - << "'"; + IOX_LOG(ERROR, "Unable to open shared memory: '" << namedPipeShmName << "' for named pipe '" << m_name << "'"); return err((m_channelSide == IpcChannelSide::CLIENT) ? IpcChannelError::NO_SUCH_CHANNEL : IpcChannelError::INTERNAL_LOGIC_ERROR); } @@ -96,7 +98,7 @@ expected NamedPipeBuilder::create() const noexcept auto allocationResult = allocator.allocate(sizeof(NamedPipe::NamedPipeData), alignof(NamedPipe::NamedPipeData)); if (allocationResult.has_error()) { - IOX_LOG(ERROR) << "Unable to allocate memory for named pipe '" << m_name << "'"; + IOX_LOG(ERROR, "Unable to allocate memory for named pipe '" << m_name << "'"); return err(IpcChannelError::MEMORY_ALLOCATION_FAILED); } auto* data = static_cast(allocationResult.value()); @@ -299,7 +301,7 @@ expected NamedPipe::timedReceive(const units::Dura expected NamedPipe::NamedPipeData::initialize(const uint32_t maxMsgNumber) noexcept { auto signalError = [&](const char* name) { - IOX_LOG(ERROR) << "Unable to create '" << name << "' semaphore for named pipe"; + IOX_LOG(ERROR, "Unable to create '" << name << "' semaphore for named pipe"); }; if (UnnamedSemaphoreBuilder() diff --git a/iceoryx_examples/ice_access_control/roudi_main_static_segments.cpp b/iceoryx_examples/ice_access_control/roudi_main_static_segments.cpp index 047d7d981f9..c46304b7396 100644 --- a/iceoryx_examples/ice_access_control/roudi_main_static_segments.cpp +++ b/iceoryx_examples/ice_access_control/roudi_main_static_segments.cpp @@ -28,7 +28,7 @@ int main(int argc, char* argv[]) auto cmdLineArgs = cmdLineParser.parse(argc, argv); if (cmdLineArgs.has_error() && (cmdLineArgs.error() != iox::config::CmdLineParserResult::INFO_OUTPUT_ONLY)) { - IOX_LOG(FATAL) << "Unable to parse command line arguments!"; + IOX_LOG(FATAL, "Unable to parse command line arguments!"); return EXIT_FAILURE; } diff --git a/iceoryx_examples/iceperf/roudi_main_static_config.cpp b/iceoryx_examples/iceperf/roudi_main_static_config.cpp index 9eb1f8e9d90..a7a66dadef3 100644 --- a/iceoryx_examples/iceperf/roudi_main_static_config.cpp +++ b/iceoryx_examples/iceperf/roudi_main_static_config.cpp @@ -30,7 +30,7 @@ int main(int argc, char* argv[]) auto cmdLineArgs = cmdLineParser.parse(argc, argv); if (cmdLineArgs.has_error() && (cmdLineArgs.error() != iox::config::CmdLineParserResult::INFO_OUTPUT_ONLY)) { - IOX_LOG(FATAL) << "Unable to parse command line arguments!"; + IOX_LOG(FATAL, "Unable to parse command line arguments!"); return EXIT_FAILURE; } diff --git a/iceoryx_hoofs/container/include/iox/detail/vector.inl b/iceoryx_hoofs/container/include/iox/detail/vector.inl index 2baff7272c0..0b81766d1cd 100644 --- a/iceoryx_hoofs/container/include/iox/detail/vector.inl +++ b/iceoryx_hoofs/container/include/iox/detail/vector.inl @@ -28,8 +28,10 @@ inline vector::vector(const uint64_t count, const T& value) noexcep { if (count > Capacity) { - IOX_LOG(ERROR) << "Attempting to initialize a vector of capacity " << Capacity << " with " << count - << " elements. This exceeds the capacity and only " << Capacity << " elements will be created!"; + IOX_LOG(ERROR, + "Attempting to initialize a vector of capacity " + << Capacity << " with " << count << " elements. This exceeds the capacity and only " << Capacity + << " elements will be created!"); } for (uint64_t i{0U}; (i < count) && (i < Capacity); ++i) @@ -43,8 +45,10 @@ inline vector::vector(const uint64_t count) noexcept { if (count > Capacity) { - IOX_LOG(ERROR) << "Attempting to initialize a vector of capacity " << Capacity << " with " << count - << " elements. This exceeds the capacity and only " << Capacity << " elements will be created!"; + IOX_LOG(ERROR, + "Attempting to initialize a vector of capacity " + << Capacity << " with " << count << " elements. This exceeds the capacity and only " << Capacity + << " elements will be created!"); } m_size = std::min(count, Capacity); diff --git a/iceoryx_hoofs/design/source/functional_interface.cpp b/iceoryx_hoofs/design/source/functional_interface.cpp index f6d078199ed..bdaf5ced58f 100644 --- a/iceoryx_hoofs/design/source/functional_interface.cpp +++ b/iceoryx_hoofs/design/source/functional_interface.cpp @@ -26,7 +26,7 @@ void print_expect_message(const char* message) noexcept { // print_expect_message is only called from expect. expect allows only // string or char arrays which are both correctly null terminated - IOX_LOG(FATAL) << message; + IOX_LOG(FATAL, message); } } // namespace internal } // namespace iox diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/cxx/variant_queue.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/cxx/variant_queue.hpp index 5e1d786b874..ac5f29b6321 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/cxx/variant_queue.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/cxx/variant_queue.hpp @@ -57,12 +57,12 @@ enum class VariantQueueTypes : uint64_t /// // overflow case /// auto status = nonOverflowingQueue.push(123); /// if ( !status ) { -/// IOX_LOG(INFO) << "queue is full"; +/// IOX_LOG(INFO, "queue is full"); /// } /// /// auto overriddenElement = overflowingQueue.push(123); /// if ( overriddenElement->has_value() ) { -/// IOX_LOG(INFO) << "element " << overriddenElement->value() << " was overridden"; +/// IOX_LOG(INFO, "element " << overriddenElement->value() << " was overridden"); /// } /// @endcode template diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/periodic_task.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/periodic_task.hpp index cadf6ff111d..6eee78a2baf 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/periodic_task.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/concurrent/periodic_task.hpp @@ -53,7 +53,7 @@ static constexpr PeriodicTaskManualStart_t PeriodicTaskManualStart; /// { /// using namespace iox::units::duration_literals; /// PeriodicTask> task{ -/// PeriodicTaskAutoStart, 1_s, "MyTask", [] { IOX_LOG(INFO) << "Hello World"; }}; +/// PeriodicTaskAutoStart, 1_s, "MyTask", [] { IOX_LOG(INFO, "Hello World"; }}); /// /// return 0; /// } diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/list.inl b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/list.inl index d6c2641adb6..1f319722ce3 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/list.inl +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/list.inl @@ -236,7 +236,7 @@ inline typename list::iterator list::emplace(const_ite if (m_size >= Capacity) { - IOX_LOG(DEBUG) << "capacity exhausted"; + IOX_LOG(DEBUG, "capacity exhausted"); return end(); } @@ -275,7 +275,7 @@ inline typename list::iterator list::erase(const_itera // further narrow-down checks if (!isValidElementIdx(eraseIdx) || empty()) { - IOX_LOG(DEBUG) << "list is empty"; + IOX_LOG(DEBUG, "list is empty"); return end(); } diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/posix_call.inl b/iceoryx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/posix_call.inl index 6a384d20552..86c4d8bbc6b 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/posix_call.inl +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/posix_call.inl @@ -190,9 +190,10 @@ PosixCallEvaluator::evaluate() const&& noexcept if (!m_details.hasSilentErrno) { - IOX_LOG(ERROR) << m_details.file << ":" << m_details.line << " { " << m_details.callingFunction << " -> " - << m_details.posixFunctionName << " } ::: [ " << m_details.result.errnum << " ] " - << m_details.result.getHumanReadableErrnum(); + IOX_LOG(ERROR, + m_details.file << ":" << m_details.line << " { " << m_details.callingFunction << " -> " + << m_details.posixFunctionName << " } ::: [ " << m_details.result.errnum << " ] " + << m_details.result.getHumanReadableErrnum()); } return err>(m_details.result); diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/posix_wrapper/posix_call.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/posix_wrapper/posix_call.hpp index e1958d7f434..c516c80aa8a 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/posix_wrapper/posix_call.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/posix_wrapper/posix_call.hpp @@ -87,14 +87,14 @@ struct PosixCallDetails /// .ignoreErrnos(ETIMEDOUT) // can be a comma separated list of errnos /// .evaluate() /// .and_then([](auto & result){ -/// IOX_LOG(INFO) << result.value; // return value of sem_timedwait -/// IOX_LOG(INFO) << result.errno; // errno which was set by sem_timedwait -/// IOX_LOG(INFO) << result.getHumanReadableErrnum(); // get string returned by strerror(errno) +/// IOX_LOG(INFO, result.value); // return value of sem_timedwait +/// IOX_LOG(INFO, result.errno); // errno which was set by sem_timedwait +/// IOX_LOG(INFO, result.getHumanReadableErrnum()); // get string returned by strerror(errno) /// }) /// .or_else([](auto & result){ -/// IOX_LOG(INFO) << result.value; // return value of sem_timedwait -/// IOX_LOG(INFO) << result.errno; // errno which was set by sem_timedwait -/// IOX_LOG(INFO) << result.getHumanReadableErrnum(); // get string returned by strerror(errno) +/// IOX_LOG(INFO, result.value); // return value of sem_timedwait +/// IOX_LOG(INFO, result.errno); // errno which was set by sem_timedwait +/// IOX_LOG(INFO, result.getHumanReadableErrnum()); // get string returned by strerror(errno) /// }) /// /// // when your posix call signals failure with one specific return value use diff --git a/iceoryx_hoofs/memory/include/iox/scope_guard.hpp b/iceoryx_hoofs/memory/include/iox/scope_guard.hpp index b2b5a54e343..3fe672d2fe8 100644 --- a/iceoryx_hoofs/memory/include/iox/scope_guard.hpp +++ b/iceoryx_hoofs/memory/include/iox/scope_guard.hpp @@ -34,9 +34,9 @@ namespace iox /// // I am doing stuff /// // goodbye /// void someFunc() { -/// ScopeGuard myScopeGuard{[](){ IOX_LOG(INFO) << "hello world\n"; }, -/// [](){ IOX_LOG(INFO) << "goodbye"; }}; -/// IOX_LOG(INFO) << "I am doing stuff"; +/// ScopeGuard myScopeGuard{[](){ IOX_LOG(INFO, "hello world\n"); }, +/// [](){ IOX_LOG(INFO, "goodbye"; }}); +/// IOX_LOG(INFO, "I am doing stuff"); /// // myScopeGuard goes out of scope here and the cleanupFunction is called in the /// // destructor /// } diff --git a/iceoryx_hoofs/memory/include/iox/unique_ptr.hpp b/iceoryx_hoofs/memory/include/iox/unique_ptr.hpp index 0bd0b0875ad..5eae9eafa58 100644 --- a/iceoryx_hoofs/memory/include/iox/unique_ptr.hpp +++ b/iceoryx_hoofs/memory/include/iox/unique_ptr.hpp @@ -40,7 +40,7 @@ namespace iox /// }); /// /// // Data can be accessed through unique_ptr -/// IOX_LOG(INFO) << myPtr->myClassMember; +/// IOX_LOG(INFO, myPtr->myClassMember); /// /// // Resetting the unique_ptr, can be performed by calling the move assignment operator /// myPtr = std::move(uniquePtrToAnotherInt); diff --git a/iceoryx_hoofs/memory/source/bump_allocator.cpp b/iceoryx_hoofs/memory/source/bump_allocator.cpp index aade0f3047d..496db530c85 100644 --- a/iceoryx_hoofs/memory/source/bump_allocator.cpp +++ b/iceoryx_hoofs/memory/source/bump_allocator.cpp @@ -38,7 +38,7 @@ expected BumpAllocator::allocate(const uint64_t size, { if (size == 0) { - IOX_LOG(WARN) << "Cannot allocate memory of size 0."; + IOX_LOG(WARN, "Cannot allocate memory of size 0."); return err(BumpAllocatorError::REQUESTED_ZERO_SIZED_MEMORY); } @@ -59,9 +59,11 @@ expected BumpAllocator::allocate(const uint64_t size, } else { - IOX_LOG(WARN) << "Trying to allocate additional " << size << " bytes in the memory of capacity " << m_length - << " when there are already " << alignedPosition << " aligned bytes in use.\n Only " - << m_length - alignedPosition << " bytes left."; + IOX_LOG(WARN, + "Trying to allocate additional " << size << " bytes in the memory of capacity " << m_length + << " when there are already " << alignedPosition + << " aligned bytes in use.\n Only " << m_length - alignedPosition + << " bytes left."); return err(BumpAllocatorError::OUT_OF_MEMORY); } diff --git a/iceoryx_hoofs/posix/design/source/file_management_interface.cpp b/iceoryx_hoofs/posix/design/source/file_management_interface.cpp index 412fa3188da..1b7a594de61 100644 --- a/iceoryx_hoofs/posix/design/source/file_management_interface.cpp +++ b/iceoryx_hoofs/posix/design/source/file_management_interface.cpp @@ -32,14 +32,15 @@ expected get_file_status(const int fildes) noexcept switch (result.error().errnum) { case EIO: - IOX_LOG(ERROR) << "Unable to acquire file status since an io failure occurred while reading."; + IOX_LOG(ERROR, "Unable to acquire file status since an io failure occurred while reading."); return err(FileStatError::IoFailure); case EOVERFLOW: - IOX_LOG(ERROR) << "Unable to acquire file status since the file size cannot be represented by the " - "corresponding structure."; + IOX_LOG(ERROR, + "Unable to acquire file status since the file size cannot be represented by the " + "corresponding structure."); return err(FileStatError::FileTooLarge); default: - IOX_LOG(ERROR) << "Unable to acquire file status due to an unknown failure"; + IOX_LOG(ERROR, "Unable to acquire file status due to an unknown failure"); return err(FileStatError::UnknownError); } } @@ -56,23 +57,24 @@ expected set_owner(const int fildes, const uid_t uid, c switch (result.error().errnum) { case EPERM: - IOX_LOG(ERROR) << "Unable to set owner due to insufficient permissions."; + IOX_LOG(ERROR, "Unable to set owner due to insufficient permissions."); return err(FileSetOwnerError::PermissionDenied); case EROFS: - IOX_LOG(ERROR) << "Unable to set owner since it is a read-only filesystem."; + IOX_LOG(ERROR, "Unable to set owner since it is a read-only filesystem."); return err(FileSetOwnerError::ReadOnlyFilesystem); case EINVAL: - IOX_LOG(ERROR) << "Unable to set owner since the uid " << uid << " or the gid " << gid - << " are not supported by the OS implementation."; + IOX_LOG(ERROR, + "Unable to set owner since the uid " << uid << " or the gid " << gid + << " are not supported by the OS implementation."); return err(FileSetOwnerError::InvalidUidOrGid); case EIO: - IOX_LOG(ERROR) << "Unable to set owner due to an IO error."; + IOX_LOG(ERROR, "Unable to set owner due to an IO error."); return err(FileSetOwnerError::IoFailure); case EINTR: - IOX_LOG(ERROR) << "Unable to set owner since an interrupt was received."; + IOX_LOG(ERROR, "Unable to set owner since an interrupt was received."); return err(FileSetOwnerError::Interrupt); default: - IOX_LOG(ERROR) << "Unable to set owner since an unknown error occurred."; + IOX_LOG(ERROR, "Unable to set owner since an unknown error occurred."); return err(FileSetOwnerError::UnknownError); } } @@ -89,13 +91,13 @@ expected set_permissions(const int fildes, const a switch (result.error().errnum) { case EPERM: - IOX_LOG(ERROR) << "Unable to adjust permissions due to insufficient permissions."; + IOX_LOG(ERROR, "Unable to adjust permissions due to insufficient permissions."); return err(FileSetPermissionError::PermissionDenied); case EROFS: - IOX_LOG(ERROR) << "Unable to adjust permissions since it is a read-only filesystem."; + IOX_LOG(ERROR, "Unable to adjust permissions since it is a read-only filesystem."); return err(FileSetPermissionError::ReadOnlyFilesystem); default: - IOX_LOG(ERROR) << "Unable to adjust permissions since an unknown error occurred."; + IOX_LOG(ERROR, "Unable to adjust permissions since an unknown error occurred."); return err(FileSetPermissionError::UnknownError); } } diff --git a/iceoryx_hoofs/posix/filesystem/source/file.cpp b/iceoryx_hoofs/posix/filesystem/source/file.cpp index 4e66eaf0f3a..4ed9d36da03 100644 --- a/iceoryx_hoofs/posix/filesystem/source/file.cpp +++ b/iceoryx_hoofs/posix/filesystem/source/file.cpp @@ -30,8 +30,8 @@ expected FileBuilder::create(const FilePath& name) noex { if (File::remove(name).has_error()) { - IOX_LOG(ERROR) << "Unable to purge and open file \"" << name.as_string() - << "\" since the file could not be removed"; + IOX_LOG(ERROR, + "Unable to purge and open file \"" << name.as_string() << "\" since the file could not be removed"); return err(FileCreationError::CannotBePurged); } } @@ -39,6 +39,8 @@ expected FileBuilder::create(const FilePath& name) noex return this->open(name); } +// NOLINTJUSTIFICATION the function size and cognitive complexity results from the error handling and the expanded log macro +// NOLINTBEGIN(readability-function-size,readability-function-cognitive-complexity) expected FileBuilder::open(const FilePath& name) noexcept { auto result = posix::posixCall(iox_open)(name.as_string().c_str(), @@ -53,7 +55,7 @@ expected FileBuilder::open(const FilePath& name) noexce const auto perms = file.get_permissions(); if (perms.has_error()) { - IOX_LOG(ERROR) << "Unable to acquire the permissions of the file."; + IOX_LOG(ERROR, "Unable to acquire the permissions of the file."); return err(FileCreationError::PermissionDenied); } @@ -61,7 +63,7 @@ expected FileBuilder::open(const FilePath& name) noexce { if ((perms->value() & perms::owner_read.value()) == 0) { - IOX_LOG(ERROR) << "Unable to open/create file due to insufficient read permissions."; + IOX_LOG(ERROR, "Unable to open/create file due to insufficient read permissions."); return err(FileCreationError::PermissionDenied); } } @@ -70,7 +72,7 @@ expected FileBuilder::open(const FilePath& name) noexce { if ((perms->value() & perms::owner_write.value()) == 0) { - IOX_LOG(ERROR) << "Unable to open/create file due to insufficient write permissions."; + IOX_LOG(ERROR, "Unable to open/create file due to insufficient write permissions."); return err(FileCreationError::PermissionDenied); } } @@ -81,47 +83,47 @@ expected FileBuilder::open(const FilePath& name) noexce switch (result.error().errnum) { case EACCES: - IOX_LOG(ERROR) << "Unable to open/create file due to insufficient permissions."; + IOX_LOG(ERROR, "Unable to open/create file due to insufficient permissions."); return err(FileCreationError::PermissionDenied); case EPERM: - IOX_LOG(ERROR) << "Unable to open/create file due to insufficient permissions."; + IOX_LOG(ERROR, "Unable to open/create file due to insufficient permissions."); return err(FileCreationError::PermissionDenied); case EINTR: - IOX_LOG(ERROR) << "Unable to open/create file since an interrupt signal was received."; + IOX_LOG(ERROR, "Unable to open/create file since an interrupt signal was received."); return err(FileCreationError::Interrupt); case EISDIR: - IOX_LOG(ERROR) << "Unable to open/create file since it is actually a directory."; + IOX_LOG(ERROR, "Unable to open/create file since it is actually a directory."); return err(FileCreationError::IsDirectory); case ELOOP: - IOX_LOG(ERROR) << "Unable to open/create file since too many symbolic links were encountered."; + IOX_LOG(ERROR, "Unable to open/create file since too many symbolic links were encountered."); return err(FileCreationError::TooManySymbolicLinksEncountered); case EMFILE: - IOX_LOG(ERROR) << "Unable to open/create file since the process limit of open file descriptors was reached."; + IOX_LOG(ERROR, "Unable to open/create file since the process limit of open file descriptors was reached."); return err(FileCreationError::ProcessLimitOfOpenFileDescriptorsReached); case ENFILE: - IOX_LOG(ERROR) << "Unable to open/create file since the system limit of open file descriptors was reached."; + IOX_LOG(ERROR, "Unable to open/create file since the system limit of open file descriptors was reached."); return err(FileCreationError::SystemLimitOfOpenFileDescriptorsReached); case ENOENT: - IOX_LOG(ERROR) << "Unable to open file since the file does not exist."; + IOX_LOG(ERROR, "Unable to open file since the file does not exist."); return err(FileCreationError::DoesNotExist); case ENOMEM: - IOX_LOG(ERROR) << "Unable to open/create file due to insufficient memory."; + IOX_LOG(ERROR, "Unable to open/create file due to insufficient memory."); return err(FileCreationError::InsufficientMemory); case EOVERFLOW: - IOX_LOG(ERROR) << "Unable to open/create file since it is too large."; + IOX_LOG(ERROR, "Unable to open/create file since it is too large."); return err(FileCreationError::FileTooLarge); case ETXTBSY: - IOX_LOG(ERROR) << "Unable to open/create file since it is currently in use."; + IOX_LOG(ERROR, "Unable to open/create file since it is currently in use."); return err(FileCreationError::CurrentlyInUse); case EEXIST: - IOX_LOG(ERROR) << "Unable to create file since it already exists."; + IOX_LOG(ERROR, "Unable to create file since it already exists."); return err(FileCreationError::AlreadyExists); default: - IOX_LOG(ERROR) << "Unable to open/create file since an unknown error occurred (" << result.error().errnum - << ")."; + IOX_LOG(ERROR, "Unable to open/create file since an unknown error occurred (" << result.error().errnum << ")."); return err(FileCreationError::UnknownError); } } +// NOLINTEND(readability-function-size,readability-function-cognitive-complexity) File::File(const int file_descriptor, const posix::AccessMode access_mode) noexcept : m_file_descriptor{file_descriptor} @@ -172,17 +174,18 @@ void File::close_fd() noexcept switch (result.error().errnum) { case EBADF: - IOX_LOG(FATAL) << "This should never happen! Unable to close file since the file descriptor is invalid."; + IOX_LOG(FATAL, "This should never happen! Unable to close file since the file descriptor is invalid."); break; case EINTR: - IOX_LOG(FATAL) << "This should never happen! Unable to close file since an interrupt signal was received."; + IOX_LOG(FATAL, "This should never happen! Unable to close file since an interrupt signal was received."); break; case EIO: - IOX_LOG(FATAL) << "This should never happen! Unable to close file due to an IO failure."; + IOX_LOG(FATAL, "This should never happen! Unable to close file due to an IO failure."); break; default: - IOX_LOG(FATAL) << "This should never happen! Unable to close file due to an unknown error (" - << result.error().errnum << ")."; + IOX_LOG(FATAL, + "This should never happen! Unable to close file due to an unknown error (" << result.error().errnum + << ")."); break; } @@ -201,22 +204,23 @@ expected File::does_exist(const FilePath& file) noexcept switch (result.error().errnum) { case EACCES: - IOX_LOG(ERROR) << "Unable to determine if file exists due to insufficient permissions."; + IOX_LOG(ERROR, "Unable to determine if file exists due to insufficient permissions."); return err(FileAccessError::InsufficientPermissions); case ENOENT: return ok(false); case ELOOP: - IOX_LOG(ERROR) << "Unable to determine if file exists due to too many symbolic links."; + IOX_LOG(ERROR, "Unable to determine if file exists due to too many symbolic links."); return err(FileAccessError::TooManySymbolicLinksEncountered); case EIO: - IOX_LOG(ERROR) << "Unable to determine if file exists due to an IO failure."; + IOX_LOG(ERROR, "Unable to determine if file exists due to an IO failure."); return err(FileAccessError::IoFailure); case ENOMEM: - IOX_LOG(ERROR) << "Unable to determine if file exists due insufficient kernel memory."; + IOX_LOG(ERROR, "Unable to determine if file exists due insufficient kernel memory."); return err(FileAccessError::InsufficientKernelMemory); default: - IOX_LOG(ERROR) << "Unable to determine if file exists since an unknown error occurred (" - << result.error().errnum << ")."; + IOX_LOG(ERROR, + "Unable to determine if file exists since an unknown error occurred (" << result.error().errnum + << ")."); return err(FileAccessError::UnknownError); } } @@ -240,28 +244,28 @@ expected File::remove(const FilePath& file) noexcept case EPERM: IOX_FALLTHROUGH; case EACCES: - IOX_LOG(ERROR) << "Unable to remove file due to insufficient permissions."; + IOX_LOG(ERROR, "Unable to remove file due to insufficient permissions."); return err(FileRemoveError::PermissionDenied); case EBUSY: - IOX_LOG(ERROR) << "Unable to remove file since it is currently in use."; + IOX_LOG(ERROR, "Unable to remove file since it is currently in use."); return err(FileRemoveError::CurrentlyInUse); case EIO: - IOX_LOG(ERROR) << "Unable to remove file due to an IO failure."; + IOX_LOG(ERROR, "Unable to remove file due to an IO failure."); return err(FileRemoveError::IoFailure); case ELOOP: - IOX_LOG(ERROR) << "Unable to remove file due to too many symbolic links."; + IOX_LOG(ERROR, "Unable to remove file due to too many symbolic links."); return err(FileRemoveError::TooManySymbolicLinksEncountered); case ENOMEM: - IOX_LOG(ERROR) << "Unable to remove file due to insufficient kernel memory."; + IOX_LOG(ERROR, "Unable to remove file due to insufficient kernel memory."); return err(FileRemoveError::InsufficientKernelMemory); case EISDIR: - IOX_LOG(ERROR) << "Unable to remove file since it is a directory."; + IOX_LOG(ERROR, "Unable to remove file since it is a directory."); return err(FileRemoveError::IsDirectory); case EROFS: - IOX_LOG(ERROR) << "Unable to remove file since it resides on a read-only file system."; + IOX_LOG(ERROR, "Unable to remove file since it resides on a read-only file system."); return err(FileRemoveError::ReadOnlyFilesystem); default: - IOX_LOG(ERROR) << "Unable to remove file since an unknown error occurred (" << result.error().errnum << ")."; + IOX_LOG(ERROR, "Unable to remove file since an unknown error occurred (" << result.error().errnum << ")."); return err(FileRemoveError::UnknownError); } } @@ -279,7 +283,7 @@ expected File::set_offset(const uint64_t offset) const no return ok(); } - IOX_LOG(ERROR) << "Unable to set file offset position since it set to the wrong offset position."; + IOX_LOG(ERROR, "Unable to set file offset position since it set to the wrong offset position."); return err(FileOffsetError::OffsetAtWrongPosition); } @@ -289,17 +293,16 @@ expected File::set_offset(const uint64_t offset) const no case EINVAL: IOX_FALLTHROUGH; case ENXIO: - IOX_LOG(ERROR) << "Unable to set file offset position since it is beyond the file limits."; + IOX_LOG(ERROR, "Unable to set file offset position since it is beyond the file limits."); return err(FileOffsetError::OffsetBeyondFileLimits); case EOVERFLOW: - IOX_LOG(ERROR) - << "Unable to set file offset position since the file is too large and the offset would overflow."; + IOX_LOG(ERROR, "Unable to set file offset position since the file is too large and the offset would overflow."); return err(FileOffsetError::FileOffsetOverflow); case ESPIPE: - IOX_LOG(ERROR) << "Unable to set file offset position since seeking is not supported by the file type."; + IOX_LOG(ERROR, "Unable to set file offset position since seeking is not supported by the file type."); return err(FileOffsetError::SeekingNotSupportedByFileType); default: - IOX_LOG(ERROR) << "Unable to remove file since an unknown error occurred (" << result.error().errnum << ")."; + IOX_LOG(ERROR, "Unable to remove file since an unknown error occurred (" << result.error().errnum << ")."); return err(FileOffsetError::UnknownError); } } @@ -309,18 +312,20 @@ expected File::read(uint8_t* const buffer, const uint64 return read_at(0, buffer, buffer_len); } +// NOLINTJUSTIFICATION the function size and cognitive complexity results from the error handling and the expanded log macro +// NOLINTBEGIN(readability-function-size,readability-function-cognitive-complexity) expected File::read_at(const uint64_t offset, uint8_t* const buffer, const uint64_t buffer_len) const noexcept { if (m_access_mode == posix::AccessMode::WRITE_ONLY) { - IOX_LOG(ERROR) << "Unable to read from file since it is opened for writing only."; + IOX_LOG(ERROR, "Unable to read from file since it is opened for writing only."); return err(FileReadError::NotOpenedForReading); } if (set_offset(offset).has_error()) { - IOX_LOG(ERROR) << "Unable to read from file since the offset could not be set."; + IOX_LOG(ERROR, "Unable to read from file since the offset could not be set."); return err(FileReadError::OffsetFailure); } @@ -334,43 +339,47 @@ File::read_at(const uint64_t offset, uint8_t* const buffer, const uint64_t buffe switch (result.error().errnum) { case EAGAIN: - IOX_LOG(ERROR) << "Unable to read from file since the operation would block."; + IOX_LOG(ERROR, "Unable to read from file since the operation would block."); return err(FileReadError::OperationWouldBlock); case EINTR: - IOX_LOG(ERROR) << "Unable to read from file since an interrupt signal was received."; + IOX_LOG(ERROR, "Unable to read from file since an interrupt signal was received."); return err(FileReadError::Interrupt); case EINVAL: - IOX_LOG(ERROR) << "Unable to read from file since it is unsuitable for reading."; + IOX_LOG(ERROR, "Unable to read from file since it is unsuitable for reading."); return err(FileReadError::FileUnsuitableForReading); case EIO: - IOX_LOG(ERROR) << "Unable to read from file since an IO failure occurred."; + IOX_LOG(ERROR, "Unable to read from file since an IO failure occurred."); return err(FileReadError::IoFailure); case EISDIR: - IOX_LOG(ERROR) << "Unable to read from file since it is a directory."; + IOX_LOG(ERROR, "Unable to read from file since it is a directory."); return err(FileReadError::IsDirectory); default: - IOX_LOG(ERROR) << "Unable to read from file since an unknown error occurred (" << result.error().errnum << ")."; + IOX_LOG(ERROR, "Unable to read from file since an unknown error occurred (" << result.error().errnum << ")."); return err(FileReadError::UnknownError); } } +// NOLINTEND(readability-function-size,readability-function-cognitive-complexity) expected File::write(const uint8_t* const buffer, const uint64_t buffer_len) const noexcept { return write_at(0, buffer, buffer_len); } + +// NOLINTJUSTIFICATION the function size and cognitive complexity results from the error handling and the expanded log macro +// NOLINTBEGIN(readability-function-size,readability-function-cognitive-complexity) expected File::write_at(const uint64_t offset, const uint8_t* const buffer, const uint64_t buffer_len) const noexcept { if (m_access_mode == posix::AccessMode::READ_ONLY) { - IOX_LOG(ERROR) << "Unable to write to file since it is opened for reading only."; + IOX_LOG(ERROR, "Unable to write to file since it is opened for reading only."); return err(FileWriteError::NotOpenedForWriting); } if (set_offset(offset).has_error()) { - IOX_LOG(ERROR) << "Unable to write to file since the offset could not be set."; + IOX_LOG(ERROR, "Unable to write to file since the offset could not be set."); return err(FileWriteError::OffsetFailure); } @@ -384,35 +393,36 @@ File::write_at(const uint64_t offset, const uint8_t* const buffer, const uint64_ switch (result.error().errnum) { case EAGAIN: - IOX_LOG(ERROR) << "Unable to write to file since the operation would block."; + IOX_LOG(ERROR, "Unable to write to file since the operation would block."); return err(FileWriteError::OperationWouldBlock); case EDQUOT: - IOX_LOG(ERROR) << "Unable to write to file since the users disk quota has been exhausted."; + IOX_LOG(ERROR, "Unable to write to file since the users disk quota has been exhausted."); return err(FileWriteError::DiskQuotaExhausted); case EFBIG: - IOX_LOG(ERROR) << "Unable to write to file since file size exceeds the maximum supported size."; + IOX_LOG(ERROR, "Unable to write to file since file size exceeds the maximum supported size."); return err(FileWriteError::FileSizeExceedsMaximumSupportedSize); case EINTR: - IOX_LOG(ERROR) << "Unable to write to file since an interrupt signal occurred."; + IOX_LOG(ERROR, "Unable to write to file since an interrupt signal occurred."); return err(FileWriteError::Interrupt); case EINVAL: - IOX_LOG(ERROR) << "Unable to write to file since the file is unsuitable for writing."; + IOX_LOG(ERROR, "Unable to write to file since the file is unsuitable for writing."); return err(FileWriteError::FileUnsuitableForWriting); case ENOSPC: - IOX_LOG(ERROR) << "Unable to write to file since there is no space left on target."; + IOX_LOG(ERROR, "Unable to write to file since there is no space left on target."); return err(FileWriteError::NoSpaceLeftOnDevice); case EPERM: - IOX_LOG(ERROR) << "Unable to write to file since the operation was prevented by a file seal."; + IOX_LOG(ERROR, "Unable to write to file since the operation was prevented by a file seal."); return err(FileWriteError::PreventedByFileSeal); case EIO: - IOX_LOG(ERROR) << "Unable to write to file since an IO failure occurred."; + IOX_LOG(ERROR, "Unable to write to file since an IO failure occurred."); return err(FileWriteError::IoFailure); default: - IOX_LOG(ERROR) << "Unable to write to file since an unknown error has occurred (" << result.error().errnum - << ")."; + IOX_LOG(ERROR, + "Unable to write to file since an unknown error has occurred (" << result.error().errnum << ")."); return err(FileWriteError::UnknownError); } } +// NOLINTEND(readability-function-size,readability-function-cognitive-complexity) int File::get_file_handle() const noexcept { diff --git a/iceoryx_hoofs/posix/time/include/iox/detail/adaptive_wait.hpp b/iceoryx_hoofs/posix/time/include/iox/detail/adaptive_wait.hpp index 74d984288f8..f23aa2d7c90 100644 --- a/iceoryx_hoofs/posix/time/include/iox/detail/adaptive_wait.hpp +++ b/iceoryx_hoofs/posix/time/include/iox/detail/adaptive_wait.hpp @@ -91,7 +91,7 @@ class adaptive_wait /// std::this_thread::yield(); /// } /// auto end = std::chrono::steady_clock::now(); - /// IOX_LOG(INFO) << (end - start).count() // prints around 1ms + /// IOX_LOG(INFO, (end - start).count()); // prints around 1ms /// @endcode static constexpr uint64_t YIELD_REPETITIONS = 10000U; diff --git a/iceoryx_hoofs/primitives/include/iox/size.hpp b/iceoryx_hoofs/primitives/include/iox/size.hpp index 832fd6c5692..5799d467f15 100644 --- a/iceoryx_hoofs/primitives/include/iox/size.hpp +++ b/iceoryx_hoofs/primitives/include/iox/size.hpp @@ -34,7 +34,7 @@ constexpr auto size(const Container& container) -> decltype(container.size()) /// @brief Get the capacity of a C array at compile time /// @code /// constexpr uint32_t FOO[42]{}; -/// IOX_LOG(INFO) << size(FOO); // will print 42 +/// IOX_LOG(INFO, size(FOO)); // will print 42 /// @endcode /// @tparam T the type of the array filled out by the compiler. /// @tparam CapacityValue the capacity of the array filled out by the compiler. diff --git a/iceoryx_hoofs/reporting/include/iox/log/logstream.hpp b/iceoryx_hoofs/reporting/include/iox/log/logstream.hpp index 38a9d62b9ba..4d30b9ee2dd 100644 --- a/iceoryx_hoofs/reporting/include/iox/log/logstream.hpp +++ b/iceoryx_hoofs/reporting/include/iox/log/logstream.hpp @@ -254,12 +254,12 @@ class LogStream /// @tparam[in] Callable with a signature 'iox::log::LogStream&(iox::log::LogStream&)' /// @param[in] c is the callable which receives a LogStream object for the actual logging /// @code - /// IOX_LOG(INFO) << [] (auto& stream) -> auto& { + /// IOX_LOG(INFO, [] (auto& stream) -> auto& { /// for(const auto& num: {13, 37, 42, 73}) { /// stream << num << " "; /// } /// return stream; - /// }; + /// }); /// @endcode template ::value>> LogStream& operator<<(const Callable& c) noexcept; diff --git a/iceoryx_hoofs/reporting/include/iox/logging.hpp b/iceoryx_hoofs/reporting/include/iox/logging.hpp index d1a0833e898..3e458701bbd 100644 --- a/iceoryx_hoofs/reporting/include/iox/logging.hpp +++ b/iceoryx_hoofs/reporting/include/iox/logging.hpp @@ -51,13 +51,7 @@ inline bool isLogLevelActive(LogLevel logLevel) noexcept iox::log::LogStream(file, line, function, level).self() << msg_stream; \ } \ [] {}() // the empty lambda forces a semicolon on the caller side -// NOLINTEND(bugprone-macro-parentheses) - -/// @todo iox-#1755 remove after porting to IOX_LOG_LAZY -#define IOX_LOG_INTERNAL_LEGACY(file, line, function, level) \ - if (iox::log::internal::isLogLevelActive(level)) \ - iox::log::LogStream(file, line, function, level).self() - + // NOLINTEND(bugprone-macro-parentheses) /// @brief Macro for logging /// @param[in] level is the log level to be used for the log message @@ -71,17 +65,10 @@ inline bool isLogLevelActive(LogLevel logLevel) noexcept // templates the resulting string is too large; we also get the file name and the line of the invocation which should be // sufficient for debugging // NOLINTBEGIN(bugprone-lambda-function-name) -/// @todo iox-#1755 rename this to IOX_LOG -#define IOX_LOG_LAZY(level, msg_stream) \ +#define IOX_LOG(level, msg_stream) \ IOX_LOG_INTERNAL(__FILE__, __LINE__, static_cast(__FUNCTION__), iox::log::LogLevel::level, msg_stream) // NOLINTEND(bugprone-lambda-function-name) -// NOLINTBEGIN(bugprone-lambda-function-name) -/// @todo iox-#1755 remove after porting to IOX_LOG_LAZY -#define IOX_LOG(level) \ - IOX_LOG_INTERNAL_LEGACY(__FILE__, __LINE__, static_cast(__FUNCTION__), iox::log::LogLevel::level) -// NOLINTEND(bugprone-lambda-function-name) - // NOLINTEND(cppcoreguidelines-macro-usage) #endif // IOX_HOOFS_REPORTING_LOGGING_HPP diff --git a/iceoryx_hoofs/source/cxx/requires.cpp b/iceoryx_hoofs/source/cxx/requires.cpp index a3f53e5e984..b425f894b5b 100644 --- a/iceoryx_hoofs/source/cxx/requires.cpp +++ b/iceoryx_hoofs/source/cxx/requires.cpp @@ -34,8 +34,9 @@ void Require( { if (!condition) { - IOX_LOG(ERROR) << "Condition: " << conditionString << " in " << function << " is violated. (" << file << ":" - << line << ")"; + IOX_LOG(ERROR, + "Condition: " << conditionString << " in " << function << " is violated. (" << file << ":" << line + << ")"); errorHandler(HoofsError::EXPECTS_ENSURES_FAILED, ErrorLevel::FATAL); } } @@ -51,8 +52,9 @@ void Require(const bool condition, { if (!condition) { - IOX_LOG(ERROR) << "Condition: " << conditionString << " in " << function << " is violated: " << msgString - << ". (" << file << ":" << line << ")"; + IOX_LOG(ERROR, + "Condition: " << conditionString << " in " << function << " is violated: " << msgString << ". (" << file + << ":" << line << ")"); errorHandler(HoofsError::EXPECTS_ENSURES_FAILED, ErrorLevel::FATAL); } } diff --git a/iceoryx_hoofs/source/error_handling/error_handler.cpp b/iceoryx_hoofs/source/error_handling/error_handler.cpp index eb24d823f95..731fdef2769 100644 --- a/iceoryx_hoofs/source/error_handling/error_handler.cpp +++ b/iceoryx_hoofs/source/error_handling/error_handler.cpp @@ -36,16 +36,16 @@ void ErrorHandler::reactOnErrorLevel(const ErrorLevel level, const char* errorNa switch (level) { case ErrorLevel::FATAL: - IOX_LOG(ERROR) << ERROR_TEXT << errorName; + IOX_LOG(ERROR, ERROR_TEXT << errorName); assert(false); std::terminate(); break; case ErrorLevel::SEVERE: - IOX_LOG(WARN) << ERROR_TEXT << errorName; + IOX_LOG(WARN, ERROR_TEXT << errorName); assert(false); break; case ErrorLevel::MODERATE: - IOX_LOG(WARN) << ERROR_TEXT << errorName; + IOX_LOG(WARN, ERROR_TEXT << errorName); break; } } diff --git a/iceoryx_hoofs/source/posix_wrapper/access_control.cpp b/iceoryx_hoofs/source/posix_wrapper/access_control.cpp index d19791efdde..4de395a47dd 100644 --- a/iceoryx_hoofs/source/posix_wrapper/access_control.cpp +++ b/iceoryx_hoofs/source/posix_wrapper/access_control.cpp @@ -27,11 +27,13 @@ namespace iox { namespace posix { +// NOLINTJUSTIFICATION the function size results from the error handling and the expanded log macro +// NOLINTNEXTLINE(readability-function-size) bool AccessController::writePermissionsToFile(const int32_t fileDescriptor) const noexcept { if (m_permissions.empty()) { - IOX_LOG(ERROR) << "Error: No ACL entries defined."; + IOX_LOG(ERROR, "Error: No ACL entries defined."); return false; } @@ -39,7 +41,7 @@ bool AccessController::writePermissionsToFile(const int32_t fileDescriptor) cons if (maybeWorkingACL.has_error()) { - IOX_LOG(ERROR) << "Error: Creating ACL failed."; + IOX_LOG(ERROR, "Error: Creating ACL failed."); return false; } @@ -65,7 +67,7 @@ bool AccessController::writePermissionsToFile(const int32_t fileDescriptor) cons if (aclCheckCall.has_error()) { - IOX_LOG(ERROR) << "Error: Invalid ACL, cannot write to file."; + IOX_LOG(ERROR, "Error: Invalid ACL, cannot write to file."); return false; } @@ -73,12 +75,13 @@ bool AccessController::writePermissionsToFile(const int32_t fileDescriptor) cons auto aclSetFdCall = posixCall(acl_set_fd)(fileDescriptor, workingACL.get()).successReturnValue(0).evaluate(); if (aclSetFdCall.has_error()) { - IOX_LOG(ERROR) << "Error: Could not set file ACL."; + IOX_LOG(ERROR, "Error: Could not set file ACL."); return false; } return true; } +// NOLINTEND(readability-function-size,readability-function-cognitive-complexity) expected AccessController::createACL(const int32_t numEntries) noexcept @@ -107,7 +110,7 @@ bool AccessController::addUserPermission(const Permission permission, const Posi { if (name.empty()) { - IOX_LOG(ERROR) << "Error: specific users must have an explicit name."; + IOX_LOG(ERROR, "Error: specific users must have an explicit name."); return false; } @@ -124,7 +127,7 @@ bool AccessController::addGroupPermission(const Permission permission, const Pos { if (name.empty()) { - IOX_LOG(ERROR) << "Error: specific groups must have an explicit name."; + IOX_LOG(ERROR, "Error: specific groups must have an explicit name."); return false; } @@ -143,7 +146,7 @@ bool AccessController::addPermissionEntry(const Category category, { if (m_permissions.size() >= m_permissions.capacity()) { - IOX_LOG(ERROR) << "Error: Number of allowed permission entries exceeded."; + IOX_LOG(ERROR, "Error: Number of allowed permission entries exceeded."); return false; } @@ -153,7 +156,7 @@ bool AccessController::addPermissionEntry(const Category category, { if (!posix::PosixUser::getUserName(id).has_value()) { - IOX_LOG(ERROR) << "Error: No such user"; + IOX_LOG(ERROR, "Error: No such user"); return false; } @@ -164,7 +167,7 @@ bool AccessController::addPermissionEntry(const Category category, { if (!posix::PosixGroup::getGroupName(id).has_value()) { - IOX_LOG(ERROR) << "Error: No such group"; + IOX_LOG(ERROR, "Error: No such group"); return false; } @@ -180,6 +183,8 @@ bool AccessController::addPermissionEntry(const Category category, return true; } +// NOLINTJUSTIFICATION the function size results from the error handling and the expanded log macro +// NOLINTNEXTLINE(readability-function-size) bool AccessController::createACLEntry(const acl_t ACL, const PermissionEntry& entry) noexcept { // create new entry in acl @@ -190,7 +195,7 @@ bool AccessController::createACLEntry(const acl_t ACL, const PermissionEntry& en if (aclCreateEntryCall.has_error()) { - IOX_LOG(ERROR) << "Error: Could not create new ACL entry."; + IOX_LOG(ERROR, "Error: Could not create new ACL entry."); return false; } @@ -200,7 +205,7 @@ bool AccessController::createACLEntry(const acl_t ACL, const PermissionEntry& en if (aclSetTagTypeCall.has_error()) { - IOX_LOG(ERROR) << "Error: Could not add tag type to ACL entry."; + IOX_LOG(ERROR, "Error: Could not add tag type to ACL entry."); return false; } @@ -214,7 +219,7 @@ bool AccessController::createACLEntry(const acl_t ACL, const PermissionEntry& en if (aclSetQualifierCall.has_error()) { - IOX_LOG(ERROR) << "Error: Could not set ACL qualifier of user " << entry.m_id; + IOX_LOG(ERROR, "Error: Could not set ACL qualifier of user " << entry.m_id); return false; } @@ -227,7 +232,7 @@ bool AccessController::createACLEntry(const acl_t ACL, const PermissionEntry& en if (aclSetQualifierCall.has_error()) { - IOX_LOG(ERROR) << "Error: Could not set ACL qualifier of group " << entry.m_id; + IOX_LOG(ERROR, "Error: Could not set ACL qualifier of group " << entry.m_id); return false; } break; @@ -244,7 +249,7 @@ bool AccessController::createACLEntry(const acl_t ACL, const PermissionEntry& en if (aclGetPermsetCall.has_error()) { - IOX_LOG(ERROR) << "Error: Could not obtain ACL permission set of new ACL entry."; + IOX_LOG(ERROR, "Error: Could not obtain ACL permission set of new ACL entry."); return false; } @@ -283,7 +288,7 @@ bool AccessController::addAclPermission(acl_permset_t permset, acl_perm_t perm) if (aclAddPermCall.has_error()) { - IOX_LOG(ERROR) << "Error: Could not add permission to ACL permission set."; + IOX_LOG(ERROR, "Error: Could not add permission to ACL permission set."); return false; } return true; diff --git a/iceoryx_hoofs/source/posix_wrapper/file_lock.cpp b/iceoryx_hoofs/source/posix_wrapper/file_lock.cpp index 4e3ddcd0251..47a9ddce614 100644 --- a/iceoryx_hoofs/source/posix_wrapper/file_lock.cpp +++ b/iceoryx_hoofs/source/posix_wrapper/file_lock.cpp @@ -37,13 +37,13 @@ expected FileLockBuilder::create() noexcept { if (!isValidFileName(m_name)) { - IOX_LOG(ERROR) << "Unable to create FileLock since the name \"" << m_name << "\" is not a valid file name."; + IOX_LOG(ERROR, "Unable to create FileLock since the name \"" << m_name << "\" is not a valid file name."); return err(FileLockError::INVALID_FILE_NAME); } if (!isValidPathToDirectory(m_path)) { - IOX_LOG(ERROR) << "Unable to create FileLock since the path \"" << m_path << "\" is not a valid path."; + IOX_LOG(ERROR, "Unable to create FileLock since the path \"" << m_path << "\" is not a valid path."); return err(FileLockError::INVALID_PATH); } @@ -78,8 +78,9 @@ expected FileLockBuilder::create() noexcept { posixCall(iox_ext_close)(fileDescriptor).failureReturnValue(-1).evaluate().or_else([&](auto& result) { IOX_DISCARD_RESULT(FileLock::convertErrnoToFileLockError(result.errnum, fileLockPath)); - IOX_LOG(ERROR) << "Unable to close file lock \"" << fileLockPath - << "\" in error related cleanup during initialization."; + IOX_LOG(ERROR, + "Unable to close file lock \"" << fileLockPath + << "\" in error related cleanup during initialization."); }); // possible errors in iox_ext_close() are masked and we inform the user about the actual error @@ -106,8 +107,9 @@ FileLock& FileLock::operator=(FileLock&& rhs) noexcept { if (closeFileDescriptor().has_error()) { - IOX_LOG(ERROR) << "Unable to cleanup file lock \"" << m_fileLockPath - << "\" in the move constructor/move assingment operator"; + IOX_LOG(ERROR, + "Unable to cleanup file lock \"" << m_fileLockPath + << "\" in the move constructor/move assingment operator"); } m_fileLockPath = std::move(rhs.m_fileLockPath); @@ -123,7 +125,7 @@ FileLock::~FileLock() noexcept { if (closeFileDescriptor().has_error()) { - IOX_LOG(ERROR) << "unable to cleanup file lock \"" << m_fileLockPath << "\" in the destructor"; + IOX_LOG(ERROR, "unable to cleanup file lock \"" << m_fileLockPath << "\" in the destructor"); } } @@ -139,19 +141,19 @@ expected FileLock::closeFileDescriptor() noexcept .or_else([&](auto& result) { cleanupFailed = true; IOX_DISCARD_RESULT(FileLock::convertErrnoToFileLockError(result.errnum, m_fileLockPath)); - IOX_LOG(ERROR) << "Unable to unlock the file lock \"" << m_fileLockPath << "\""; + IOX_LOG(ERROR, "Unable to unlock the file lock \"" << m_fileLockPath << '"'); }); posixCall(iox_ext_close)(m_fd).failureReturnValue(-1).evaluate().or_else([&](auto& result) { cleanupFailed = true; IOX_DISCARD_RESULT(FileLock::convertErrnoToFileLockError(result.errnum, m_fileLockPath)); - IOX_LOG(ERROR) << "Unable to close the file handle to the file lock \"" << m_fileLockPath << "\""; + IOX_LOG(ERROR, "Unable to close the file handle to the file lock \"" << m_fileLockPath << '"'); }); posixCall(remove)(m_fileLockPath.c_str()).failureReturnValue(-1).evaluate().or_else([&](auto& result) { cleanupFailed = true; IOX_DISCARD_RESULT(FileLock::convertErrnoToFileLockError(result.errnum, m_fileLockPath)); - IOX_LOG(ERROR) << "Unable to remove the file lock \"" << m_fileLockPath << "\""; + IOX_LOG(ERROR, "Unable to remove the file lock \"" << m_fileLockPath << '"'); }); if (cleanupFailed) @@ -177,87 +179,83 @@ FileLockError FileLock::convertErrnoToFileLockError(const int32_t errnum, const { case EACCES: { - IOX_LOG(ERROR) << "permission denied for file lock \"" << fileLockPath << "\""; + IOX_LOG(ERROR, "permission denied for file lock \"" << fileLockPath << '"'); return FileLockError::ACCESS_DENIED; } case EDQUOT: { - IOX_LOG(ERROR) << "user disk quota exhausted for file lock \"" << fileLockPath << "\""; + IOX_LOG(ERROR, "user disk quota exhausted for file lock \"" << fileLockPath << '"'); return FileLockError::QUOTA_EXHAUSTED; } case EFAULT: { - IOX_LOG(ERROR) << "outside address space error for file lock \"" << fileLockPath << "\""; + IOX_LOG(ERROR, "outside address space error for file lock \"" << fileLockPath << '"'); return FileLockError::ACCESS_DENIED; } case EFBIG: case EOVERFLOW: { - IOX_LOG(ERROR) << "file lock \"" << fileLockPath << "\"" - << " is too large to be openend"; + IOX_LOG(ERROR, "file lock \"" << fileLockPath << '"' << " is too large to be openend"); return FileLockError::FILE_TOO_LARGE; } case ELOOP: { - IOX_LOG(ERROR) << "too many symbolic links for file lock \"" << fileLockPath << "\""; + IOX_LOG(ERROR, "too many symbolic links for file lock \"" << fileLockPath << '"'); return FileLockError::INVALID_FILE_NAME; } case EMFILE: { - IOX_LOG(ERROR) << "process limit reached for file lock \"" << fileLockPath << "\""; + IOX_LOG(ERROR, "process limit reached for file lock \"" << fileLockPath << '"'); return FileLockError::PROCESS_LIMIT; } case ENFILE: { - IOX_LOG(ERROR) << "system limit reached for file lock \"" << fileLockPath << "\""; + IOX_LOG(ERROR, "system limit reached for file lock \"" << fileLockPath << '"'); return FileLockError::SYSTEM_LIMIT; } case ENODEV: { - IOX_LOG(ERROR) << "permission to access file lock denied \"" << fileLockPath << "\""; + IOX_LOG(ERROR, "permission to access file lock denied \"" << fileLockPath << '"'); return FileLockError::ACCESS_DENIED; } case ENOENT: { - IOX_LOG(ERROR) << "directory \"" << &platform::IOX_LOCK_FILE_PATH_PREFIX[0] << "\"" - << " does not exist."; + IOX_LOG(ERROR, "directory \"" << &platform::IOX_LOCK_FILE_PATH_PREFIX[0] << '"' << " does not exist."); return FileLockError::NO_SUCH_DIRECTORY; } case ENOMEM: { - IOX_LOG(ERROR) << "out of memory for file lock \"" << fileLockPath << "\""; + IOX_LOG(ERROR, "out of memory for file lock \"" << fileLockPath << '"'); return FileLockError::OUT_OF_MEMORY; } case ENOSPC: { - IOX_LOG(ERROR) << "Device has no space for file lock \"" << fileLockPath << "\""; + IOX_LOG(ERROR, "Device has no space for file lock \"" << fileLockPath << '"'); return FileLockError::QUOTA_EXHAUSTED; } case ENOSYS: { - IOX_LOG(ERROR) << "open() not implemented for filesystem to \"" << fileLockPath << "\""; + IOX_LOG(ERROR, "open() not implemented for filesystem to \"" << fileLockPath << '"'); return FileLockError::SYS_CALL_NOT_IMPLEMENTED; } case ENXIO: { - IOX_LOG(ERROR) << "\"" << fileLockPath << "\"" - << " is a special file and no corresponding device exists"; + IOX_LOG(ERROR, '"' << fileLockPath << '"' << " is a special file and no corresponding device exists"); return FileLockError::SPECIAL_FILE; } case EPERM: { - IOX_LOG(ERROR) << "permission denied to file lock \"" << fileLockPath << "\""; + IOX_LOG(ERROR, "permission denied to file lock \"" << fileLockPath << '"'); return FileLockError::ACCESS_DENIED; } case EROFS: { - IOX_LOG(ERROR) << "read only error for file lock \"" << fileLockPath << "\""; + IOX_LOG(ERROR, "read only error for file lock \"" << fileLockPath << '"'); return FileLockError::INVALID_FILE_NAME; } case ETXTBSY: { - IOX_LOG(ERROR) << "write access requested for file lock \"" << fileLockPath << "\"" - << " in use"; + IOX_LOG(ERROR, "write access requested for file lock \"" << fileLockPath << '"' << " in use"); return FileLockError::FILE_IN_USE; } case EWOULDBLOCK: @@ -267,17 +265,17 @@ FileLockError FileLock::convertErrnoToFileLockError(const int32_t errnum, const } case ENOLCK: { - IOX_LOG(ERROR) << "system limit for locks reached for file lock \"" << fileLockPath << "\""; + IOX_LOG(ERROR, "system limit for locks reached for file lock \"" << fileLockPath << '"'); return FileLockError::SYSTEM_LIMIT; } case EIO: { - IOX_LOG(ERROR) << "I/O for file lock \"" << fileLockPath << "\""; + IOX_LOG(ERROR, "I/O for file lock \"" << fileLockPath << '"'); return FileLockError::I_O_ERROR; } default: { - IOX_LOG(ERROR) << "internal logic error in file lock \"" << fileLockPath << "\" occurred"; + IOX_LOG(ERROR, "internal logic error in file lock \"" << fileLockPath << "\" occurred"); return FileLockError::INTERNAL_LOGIC_ERROR; } } diff --git a/iceoryx_hoofs/source/posix_wrapper/mutex.cpp b/iceoryx_hoofs/source/posix_wrapper/mutex.cpp index 50486b8a03b..e6dd92c1deb 100644 --- a/iceoryx_hoofs/source/posix_wrapper/mutex.cpp +++ b/iceoryx_hoofs/source/posix_wrapper/mutex.cpp @@ -44,8 +44,8 @@ struct MutexAttributes posixCall(pthread_mutexattr_destroy)(&*m_attributes).returnValueMatchesErrno().evaluate(); if (destroyResult.has_error()) { - IOX_LOG(ERROR) - << "This should never happen. An unknown error occurred while cleaning up the mutex attributes."; + IOX_LOG(ERROR, + "This should never happen. An unknown error occurred while cleaning up the mutex attributes."); } } } @@ -59,11 +59,11 @@ struct MutexAttributes switch (result.error().errnum) { case ENOMEM: - IOX_LOG(ERROR) << "Not enough memory to initialize required mutex attributes"; + IOX_LOG(ERROR, "Not enough memory to initialize required mutex attributes"); return err(MutexCreationError::INSUFFICIENT_MEMORY); default: - IOX_LOG(ERROR) - << "This should never happen. An unknown error occurred while initializing the mutex attributes."; + IOX_LOG(ERROR, + "This should never happen. An unknown error occurred while initializing the mutex attributes."); return err(MutexCreationError::UNKNOWN_ERROR); } } @@ -83,12 +83,12 @@ struct MutexAttributes switch (result.error().errnum) { case ENOTSUP: - IOX_LOG(ERROR) << "The platform does not support shared mutex (inter process mutex)"; + IOX_LOG(ERROR, "The platform does not support shared mutex (inter process mutex)"); return err(MutexCreationError::INTER_PROCESS_MUTEX_UNSUPPORTED_BY_PLATFORM); default: - IOX_LOG(ERROR) - << "This should never happen. An unknown error occurred while setting up the inter process " - "configuration."; + IOX_LOG(ERROR, + "This should never happen. An unknown error occurred while setting up the inter process " + "configuration."); return err(MutexCreationError::UNKNOWN_ERROR); } } @@ -103,7 +103,7 @@ struct MutexAttributes .evaluate(); if (result.has_error()) { - IOX_LOG(ERROR) << "This should never happen. An unknown error occurred while setting up the mutex type."; + IOX_LOG(ERROR, "This should never happen. An unknown error occurred while setting up the mutex type."); return err(MutexCreationError::UNKNOWN_ERROR); } @@ -120,17 +120,17 @@ struct MutexAttributes switch (result.error().errnum) { case ENOSYS: - IOX_LOG(ERROR) << "The system does not support mutex priorities"; + IOX_LOG(ERROR, "The system does not support mutex priorities"); return err(MutexCreationError::PRIORITIES_UNSUPPORTED_BY_PLATFORM); case ENOTSUP: - IOX_LOG(ERROR) << "The used mutex priority is not supported by the platform"; + IOX_LOG(ERROR, "The used mutex priority is not supported by the platform"); return err(MutexCreationError::USED_PRIORITY_UNSUPPORTED_BY_PLATFORM); case EPERM: - IOX_LOG(ERROR) << "Insufficient permissions to set mutex priorities"; + IOX_LOG(ERROR, "Insufficient permissions to set mutex priorities"); return err(MutexCreationError::PERMISSION_DENIED); default: - IOX_LOG(ERROR) - << "This should never happen. An unknown error occurred while setting up the mutex priority."; + IOX_LOG(ERROR, + "This should never happen. An unknown error occurred while setting up the mutex priority."); return err(MutexCreationError::UNKNOWN_ERROR); } } @@ -148,19 +148,20 @@ struct MutexAttributes switch (result.error().errnum) { case EPERM: - IOX_LOG(ERROR) << "Insufficient permissions to set the mutex priority ceiling."; + IOX_LOG(ERROR, "Insufficient permissions to set the mutex priority ceiling."); return err(MutexCreationError::PERMISSION_DENIED); case ENOSYS: - IOX_LOG(ERROR) << "The platform does not support mutex priority ceiling."; + IOX_LOG(ERROR, "The platform does not support mutex priority ceiling."); return err(MutexCreationError::PRIORITIES_UNSUPPORTED_BY_PLATFORM); case EINVAL: { auto minimumPriority = getSchedulerPriorityMinimum(Scheduler::FIFO); auto maximumPriority = getSchedulerPriorityMaximum(Scheduler::FIFO); - IOX_LOG(ERROR) << "The priority ceiling \"" << priorityCeiling - << "\" is not in the valid priority range [ " << minimumPriority << ", " - << maximumPriority << "] of the Scheduler::FIFO."; + IOX_LOG(ERROR, + "The priority ceiling \"" << priorityCeiling << "\" is not in the valid priority range [ " + << minimumPriority << ", " << maximumPriority + << "] of the Scheduler::FIFO."); return err(MutexCreationError::INVALID_PRIORITY_CEILING_VALUE); } } @@ -177,8 +178,9 @@ struct MutexAttributes .evaluate(); if (result.has_error()) { - IOX_LOG(ERROR) << "This should never happen. An unknown error occurred while setting up the mutex thread " - "termination behavior."; + IOX_LOG(ERROR, + "This should never happen. An unknown error occurred while setting up the mutex thread " + "termination behavior."); return err(MutexCreationError::UNKNOWN_ERROR); } @@ -197,18 +199,18 @@ expected initializeMutex(pthread_mutex_t* const handle switch (initResult.error().errnum) { case EAGAIN: - IOX_LOG(ERROR) << "Not enough resources to initialize another mutex."; + IOX_LOG(ERROR, "Not enough resources to initialize another mutex."); return err(MutexCreationError::INSUFFICIENT_RESOURCES); case ENOMEM: - IOX_LOG(ERROR) << "Not enough memory to initialize mutex."; + IOX_LOG(ERROR, "Not enough memory to initialize mutex."); return err(MutexCreationError::INSUFFICIENT_MEMORY); case EPERM: - IOX_LOG(ERROR) << "Insufficient permissions to create mutex."; + IOX_LOG(ERROR, "Insufficient permissions to create mutex."); return err(MutexCreationError::PERMISSION_DENIED); default: - IOX_LOG(ERROR) - << "This should never happen. An unknown error occurred while initializing the mutex handle. " - "This is possible when the handle is an already initialized mutex handle."; + IOX_LOG(ERROR, + "This should never happen. An unknown error occurred while initializing the mutex handle. " + "This is possible when the handle is an already initialized mutex handle."); return err(MutexCreationError::UNKNOWN_ERROR); } } @@ -220,7 +222,7 @@ expected MutexBuilder::create(optional& uniniti { if (uninitializedMutex.has_value()) { - IOX_LOG(ERROR) << "Unable to override an already initialized mutex with a new mutex"; + IOX_LOG(ERROR, "Unable to override an already initialized mutex with a new mutex"); return err(MutexCreationError::MUTEX_ALREADY_INITIALIZED); } @@ -290,11 +292,12 @@ mutex::~mutex() noexcept switch (destroyCall.error().errnum) { case EBUSY: - IOX_LOG(ERROR) << "Tried to remove a locked mutex which failed. The mutex handle is now leaked and " - "cannot be removed anymore!"; + IOX_LOG(ERROR, + "Tried to remove a locked mutex which failed. The mutex handle is now leaked and " + "cannot be removed anymore!"); break; default: - IOX_LOG(ERROR) << "This should never happen. An unknown error occurred while cleaning up the mutex."; + IOX_LOG(ERROR, "This should never happen. An unknown error occurred while cleaning up the mutex."); break; } } @@ -310,7 +313,7 @@ void mutex::make_consistent() noexcept .evaluate() .and_then([&](auto) { this->m_hasInconsistentState = false; }) .or_else([](auto) { - IOX_LOG(ERROR) << "This should never happen. Unable to put robust mutex in a consistent state!"; + IOX_LOG(ERROR, "This should never happen. Unable to put robust mutex in a consistent state!"); }); } } @@ -323,25 +326,26 @@ expected mutex::lock() noexcept switch (result.error().errnum) { case EINVAL: - IOX_LOG(ERROR) - << "The mutex has the attribute MutexPriorityInheritance::PROTECT set and the calling threads " - "priority is greater than the mutex priority."; + IOX_LOG(ERROR, + "The mutex has the attribute MutexPriorityInheritance::PROTECT set and the calling threads " + "priority is greater than the mutex priority."); return err(MutexLockError::PRIORITY_MISMATCH); case EAGAIN: - IOX_LOG(ERROR) << "Maximum number of recursive locks exceeded."; + IOX_LOG(ERROR, "Maximum number of recursive locks exceeded."); return err(MutexLockError::MAXIMUM_NUMBER_OF_RECURSIVE_LOCKS_EXCEEDED); case EDEADLK: - IOX_LOG(ERROR) << "Deadlock in mutex detected."; + IOX_LOG(ERROR, "Deadlock in mutex detected."); return err(MutexLockError::DEADLOCK_CONDITION); case EOWNERDEAD: - IOX_LOG(ERROR) - << "The thread/process which owned the mutex died. The mutex is now in an inconsistent state " - "and must be put into a consistent state again with Mutex::make_consistent()"; + IOX_LOG(ERROR, + "The thread/process which owned the mutex died. The mutex is now in an inconsistent state " + "and must be put into a consistent state again with Mutex::make_consistent()"); this->m_hasInconsistentState = true; return err(MutexLockError::LOCK_ACQUIRED_BUT_HAS_INCONSISTENT_STATE_SINCE_OWNER_DIED); default: - IOX_LOG(ERROR) << "This should never happen. An unknown error occurred while locking the mutex. " - "This can indicate a either corrupted or non-POSIX compliant system."; + IOX_LOG(ERROR, + "This should never happen. An unknown error occurred while locking the mutex. " + "This can indicate a either corrupted or non-POSIX compliant system."); return err(MutexLockError::UNKNOWN_ERROR); } } @@ -356,12 +360,14 @@ expected mutex::unlock() noexcept switch (result.error().errnum) { case EPERM: - IOX_LOG(ERROR) << "The mutex is not owned by the current thread. The mutex must be unlocked by the same " - "thread it was locked by."; + IOX_LOG(ERROR, + "The mutex is not owned by the current thread. The mutex must be unlocked by the same " + "thread it was locked by."); return err(MutexUnlockError::NOT_OWNED_BY_THREAD); default: - IOX_LOG(ERROR) << "This should never happen. An unknown error occurred while unlocking the mutex. " - "This can indicate a either corrupted or non-POSIX compliant system."; + IOX_LOG(ERROR, + "This should never happen. An unknown error occurred while unlocking the mutex. " + "This can indicate a either corrupted or non-POSIX compliant system."); return err(MutexUnlockError::UNKNOWN_ERROR); } } @@ -378,22 +384,23 @@ expected mutex::try_lock() noexcept switch (result.error().errnum) { case EAGAIN: - IOX_LOG(ERROR) << "Maximum number of recursive locks exceeded."; + IOX_LOG(ERROR, "Maximum number of recursive locks exceeded."); return err(MutexTryLockError::MAXIMUM_NUMBER_OF_RECURSIVE_LOCKS_EXCEEDED); case EINVAL: - IOX_LOG(ERROR) - << "The mutex has the attribute MutexPriorityInheritance::PROTECT set and the calling threads " - "priority is greater than the mutex priority."; + IOX_LOG(ERROR, + "The mutex has the attribute MutexPriorityInheritance::PROTECT set and the calling threads " + "priority is greater than the mutex priority."); return err(MutexTryLockError::PRIORITY_MISMATCH); case EOWNERDEAD: - IOX_LOG(ERROR) - << "The thread/process which owned the mutex died. The mutex is now in an inconsistent state " - "and must be put into a consistent state again with Mutex::make_consistent()"; + IOX_LOG(ERROR, + "The thread/process which owned the mutex died. The mutex is now in an inconsistent state and must " + "be put into a consistent state again with Mutex::make_consistent()"); this->m_hasInconsistentState = true; return err(MutexTryLockError::LOCK_ACQUIRED_BUT_HAS_INCONSISTENT_STATE_SINCE_OWNER_DIED); default: - IOX_LOG(ERROR) << "This should never happen. An unknown error occurred while trying to lock the mutex. " - "This can indicate a either corrupted or non-POSIX compliant system."; + IOX_LOG(ERROR, + "This should never happen. An unknown error occurred while trying to lock the mutex. This can " + "indicate a either corrupted or non-POSIX compliant system."); return err(MutexTryLockError::UNKNOWN_ERROR); } } diff --git a/iceoryx_hoofs/source/posix_wrapper/named_semaphore.cpp b/iceoryx_hoofs/source/posix_wrapper/named_semaphore.cpp index 95ccdd47a9b..8d6488f56f6 100644 --- a/iceoryx_hoofs/source/posix_wrapper/named_semaphore.cpp +++ b/iceoryx_hoofs/source/posix_wrapper/named_semaphore.cpp @@ -40,11 +40,12 @@ static expected unlink(const NamedSemaphore::Name_t& name) switch (result.error().errnum) { case EACCES: - IOX_LOG(ERROR) << "You don't have permission to remove the semaphore \"" << name << "\""; + IOX_LOG(ERROR, "You don't have permission to remove the semaphore \"" << name << '"'); return err(SemaphoreError::PERMISSION_DENIED); default: - IOX_LOG(ERROR) << "This should never happen. An unknown error occurred while creating the semaphore \"" - << name << "\"."; + IOX_LOG(ERROR, + "This should never happen. An unknown error occurred while creating the semaphore \"" << name + << '"'); return err(SemaphoreError::UNDEFINED); } } @@ -66,22 +67,23 @@ tryOpenExistingSemaphore(optional& uninitializedSemaphore, const switch (result.error().errnum) { case EACCES: - IOX_LOG(ERROR) << "Insufficient permissions to open semaphore \"" << name << "\"."; + IOX_LOG(ERROR, "Insufficient permissions to open semaphore \"" << name << '"'); return err(SemaphoreError::PERMISSION_DENIED); case EMFILE: - IOX_LOG(ERROR) << "The per-process limit of file descriptor exceeded while opening the semaphore \"" << name - << "\""; + IOX_LOG(ERROR, + "The per-process limit of file descriptor exceeded while opening the semaphore \"" << name << '"'); return err(SemaphoreError::FILE_DESCRIPTOR_LIMIT_REACHED); case ENFILE: - IOX_LOG(ERROR) << "The system wide limit of file descriptor exceeded while opening the semaphore \"" << name - << "\""; + IOX_LOG(ERROR, + "The system wide limit of file descriptor exceeded while opening the semaphore \"" << name << '"'); return err(SemaphoreError::FILE_DESCRIPTOR_LIMIT_REACHED); case ENOMEM: - IOX_LOG(ERROR) << "Insufficient memory to open the semaphore \"" << name << "\"."; + IOX_LOG(ERROR, "Insufficient memory to open the semaphore \"" << name << '"'); return err(SemaphoreError::OUT_OF_MEMORY); default: - IOX_LOG(ERROR) << "This should never happen. An unknown error occurred while opening the semaphore \"" - << name << "\"."; + IOX_LOG(ERROR, + "This should never happen. An unknown error occurred while opening the semaphore \"" << name + << '"'); return err(SemaphoreError::UNDEFINED); } } @@ -119,28 +121,30 @@ static expected createSemaphore(optional& switch (result.error().errnum) { case EACCES: - IOX_LOG(ERROR) << "Insufficient permissions to create semaphore \"" << name << "\"."; + IOX_LOG(ERROR, "Insufficient permissions to create semaphore \"" << name << '"'); return err(SemaphoreError::PERMISSION_DENIED); case EEXIST: - IOX_LOG(ERROR) - << "A semaphore with the name \"" << name - << "\" does already exist. This should not happen until there is a race condition when multiple " - "instances try to create the same named semaphore concurrently."; + IOX_LOG(ERROR, + "A semaphore with the name \"" + << name + << "\" does already exist. This should not happen until there is a race condition when " + "multiple instances try to create the same named semaphore concurrently."); return err(SemaphoreError::ALREADY_EXIST); case EMFILE: - IOX_LOG(ERROR) << "The per-process limit of file descriptor exceeded while creating the semaphore \"" - << name << "\""; + IOX_LOG(ERROR, + "The per-process limit of file descriptor exceeded while creating the semaphore \"" << name << '"'); return err(SemaphoreError::FILE_DESCRIPTOR_LIMIT_REACHED); case ENFILE: - IOX_LOG(ERROR) << "The system wide limit of file descriptor exceeded while creating the semaphore \"" - << name << "\""; + IOX_LOG(ERROR, + "The system wide limit of file descriptor exceeded while creating the semaphore \"" << name << '"'); return err(SemaphoreError::FILE_DESCRIPTOR_LIMIT_REACHED); case ENOMEM: - IOX_LOG(ERROR) << "Insufficient memory to create the semaphore \"" << name << "\"."; + IOX_LOG(ERROR, "Insufficient memory to create the semaphore \"" << name << '"'); return err(SemaphoreError::OUT_OF_MEMORY); default: - IOX_LOG(ERROR) << "This should never happen. An unknown error occurred while creating the semaphore \"" - << name << "\"."; + IOX_LOG(ERROR, + "This should never happen. An unknown error occurred while creating the semaphore \"" << name + << '"'); return err(SemaphoreError::UNDEFINED); } } @@ -159,14 +163,15 @@ NamedSemaphoreBuilder::create(optional& uninitializedSemaphore) { if (!isValidFileName(m_name)) { - IOX_LOG(ERROR) << "The name \"" << m_name << "\" is not a valid semaphore name."; + IOX_LOG(ERROR, "The name \"" << m_name << "\" is not a valid semaphore name."); return err(SemaphoreError::INVALID_NAME); } if (m_initialValue > IOX_SEM_VALUE_MAX) { - IOX_LOG(ERROR) << "The semaphores \"" << m_name << "\" initial value of " << m_initialValue - << " exceeds the maximum semaphore value " << IOX_SEM_VALUE_MAX; + IOX_LOG(ERROR, + "The semaphores \"" << m_name << "\" initial value of " << m_initialValue + << " exceeds the maximum semaphore value " << IOX_SEM_VALUE_MAX); return err(SemaphoreError::SEMAPHORE_OVERFLOW); } @@ -180,7 +185,7 @@ NamedSemaphoreBuilder::create(optional& uninitializedSemaphore) if (!result.value()) { - IOX_LOG(ERROR) << "Unable to open semaphore since no semaphore with the name \"" << m_name << "\" exists."; + IOX_LOG(ERROR, "Unable to open semaphore since no semaphore with the name \"" << m_name << "\" exists."); return err(SemaphoreError::NO_SEMAPHORE_WITH_THAT_NAME_EXISTS); } return ok(); @@ -227,7 +232,7 @@ NamedSemaphore::~NamedSemaphore() noexcept { if (posixCall(iox_sem_close)(m_handle).failureReturnValue(-1).evaluate().has_error()) { - IOX_LOG(ERROR) << "This should never happen. Unable to close named semaphore \"" << m_name << "\""; + IOX_LOG(ERROR, "This should never happen. Unable to close named semaphore \"" << m_name << '"'); } if (m_hasOwnership) diff --git a/iceoryx_hoofs/source/posix_wrapper/posix_access_rights.cpp b/iceoryx_hoofs/source/posix_wrapper/posix_access_rights.cpp index f0e077e7aef..881a10d9df3 100644 --- a/iceoryx_hoofs/source/posix_wrapper/posix_access_rights.cpp +++ b/iceoryx_hoofs/source/posix_wrapper/posix_access_rights.cpp @@ -46,7 +46,7 @@ PosixGroup::PosixGroup(const PosixGroup::groupName_t& name) noexcept } else { - IOX_LOG(ERROR) << "Error: Group name not found"; + IOX_LOG(ERROR, "Error: Group name not found"); m_id = std::numeric_limits::max(); } } @@ -67,7 +67,7 @@ optional PosixGroup::getGroupID(const PosixGroup::groupName_t& name) noex if (getgrnamCall.has_error()) { - IOX_LOG(ERROR) << "Error: Could not find group '" << name << "'."; + IOX_LOG(ERROR, "Error: Could not find group '" << name << "'."); return nullopt_t(); } @@ -80,7 +80,7 @@ optional PosixGroup::getGroupName(gid_t id) noexcept if (getgrgidCall.has_error()) { - IOX_LOG(ERROR) << "Error: Could not find group with id '" << id << "'."; + IOX_LOG(ERROR, "Error: Could not find group with id '" << id << "'."); return nullopt_t(); } @@ -114,7 +114,7 @@ optional PosixUser::getUserID(const userName_t& name) noexcept if (getpwnamCall.has_error()) { - IOX_LOG(ERROR) << "Error: Could not find user '" << name << "'."; + IOX_LOG(ERROR, "Error: Could not find user '" << name << "'."); return nullopt_t(); } return make_optional(getpwnamCall->value->pw_uid); @@ -126,7 +126,7 @@ optional PosixUser::getUserName(uid_t id) noexcept if (getpwuidCall.has_error()) { - IOX_LOG(ERROR) << "Error: Could not find user with id'" << id << "'."; + IOX_LOG(ERROR, "Error: Could not find user with id'" << id << "'."); return nullopt_t(); } return make_optional(userName_t(iox::TruncateToCapacity, getpwuidCall->value->pw_name)); @@ -143,7 +143,7 @@ PosixUser::groupVector_t PosixUser::getGroups() const noexcept auto getpwnamCall = posixCall(getpwnam)(userName->c_str()).failureReturnValue(nullptr).evaluate(); if (getpwnamCall.has_error()) { - IOX_LOG(ERROR) << "Error: getpwnam call failed"; + IOX_LOG(ERROR, "Error: getpwnam call failed"); return groupVector_t(); } @@ -156,13 +156,13 @@ PosixUser::groupVector_t PosixUser::getGroups() const noexcept .evaluate(); if (getgrouplistCall.has_error()) { - IOX_LOG(ERROR) << "Error: Could not obtain group list"; + IOX_LOG(ERROR, "Error: Could not obtain group list"); return groupVector_t(); } if (numGroups == -1) { - IOX_LOG(ERROR) << "Error: List with negative size returned"; + IOX_LOG(ERROR, "Error: List with negative size returned"); return groupVector_t(); } @@ -190,7 +190,7 @@ PosixUser::PosixUser(const PosixUser::userName_t& name) noexcept } else { - IOX_LOG(ERROR) << "Error: User name not found"; + IOX_LOG(ERROR, "Error: User name not found"); m_id = std::numeric_limits::max(); } } diff --git a/iceoryx_hoofs/source/posix_wrapper/scheduler.cpp b/iceoryx_hoofs/source/posix_wrapper/scheduler.cpp index e68ef4bcdf8..3e725207ba7 100644 --- a/iceoryx_hoofs/source/posix_wrapper/scheduler.cpp +++ b/iceoryx_hoofs/source/posix_wrapper/scheduler.cpp @@ -28,9 +28,9 @@ int32_t getSchedulerPriorityMinimum(const Scheduler scheduler) noexcept auto result = posixCall(sched_get_priority_min)(static_cast(scheduler)).failureReturnValue(-1).evaluate(); if (result.has_error()) { - IOX_LOG(ERROR) - << "The \"sched_get_priority_min\" should never fail. This can only be caused by an internal logic " - "error or a non posix compliant system."; + IOX_LOG(ERROR, + "The \"sched_get_priority_min\" should never fail. This can only be caused by an internal logic error " + "or a non posix compliant system."); // NOLINTJUSTIFICATION Required to provide an error message to the user // NOLINTNEXTLINE(hicpp-no-array-decay,cppcoreguidelines-pro-bounds-array-to-pointer-decay) @@ -48,9 +48,9 @@ int32_t getSchedulerPriorityMaximum(const Scheduler scheduler) noexcept auto result = posixCall(sched_get_priority_max)(static_cast(scheduler)).failureReturnValue(-1).evaluate(); if (result.has_error()) { - IOX_LOG(ERROR) - << "The \"sched_get_priority_max\" should never fail. This can only be caused by an internal logic " - "error or a non posix compliant system."; + IOX_LOG(ERROR, + "The \"sched_get_priority_max\" should never fail. This can only be caused by an internal logic " + "error or a non posix compliant system."); // NOLINTJUSTIFICATION Required to provide an error message to the user // NOLINTNEXTLINE(hicpp-no-array-decay,cppcoreguidelines-pro-bounds-array-to-pointer-decay) diff --git a/iceoryx_hoofs/source/posix_wrapper/semaphore_interface.cpp b/iceoryx_hoofs/source/posix_wrapper/semaphore_interface.cpp index 65c2c5fee07..1b9e0d5d248 100644 --- a/iceoryx_hoofs/source/posix_wrapper/semaphore_interface.cpp +++ b/iceoryx_hoofs/source/posix_wrapper/semaphore_interface.cpp @@ -31,16 +31,16 @@ SemaphoreError errnoToEnum(const int32_t errnum) noexcept switch (errnum) { case EINVAL: - IOX_LOG(ERROR) << "The semaphore handle is no longer valid. This can indicate a corrupted system."; + IOX_LOG(ERROR, "The semaphore handle is no longer valid. This can indicate a corrupted system."); return SemaphoreError::INVALID_SEMAPHORE_HANDLE; case EOVERFLOW: - IOX_LOG(ERROR) << "Semaphore overflow. The maximum value of " << IOX_SEM_VALUE_MAX << " would be exceeded."; + IOX_LOG(ERROR, "Semaphore overflow. The maximum value of " << IOX_SEM_VALUE_MAX << " would be exceeded."); return SemaphoreError::SEMAPHORE_OVERFLOW; case EINTR: - IOX_LOG(ERROR) << "The semaphore call was interrupted multiple times by the operating system. Abort operation!"; + IOX_LOG(ERROR, "The semaphore call was interrupted multiple times by the operating system. Abort operation!"); return SemaphoreError::INTERRUPTED_BY_SIGNAL_HANDLER; default: - IOX_LOG(ERROR) << "This should never happen. An unknown error occurred."; + IOX_LOG(ERROR, "This should never happen. An unknown error occurred."); break; } return SemaphoreError::UNDEFINED; diff --git a/iceoryx_hoofs/source/posix_wrapper/shared_memory_object.cpp b/iceoryx_hoofs/source/posix_wrapper/shared_memory_object.cpp index 2f49ff979e5..fcb054d1680 100644 --- a/iceoryx_hoofs/source/posix_wrapper/shared_memory_object.cpp +++ b/iceoryx_hoofs/source/posix_wrapper/shared_memory_object.cpp @@ -70,12 +70,12 @@ expected SharedMemoryObjectBuilder: return stream; }; - IOX_LOG(ERROR) << "Unable to create a shared memory object with the following properties [ name = " << m_name - << ", sizeInBytes = " << m_memorySizeInBytes - << ", access mode = " << asStringLiteral(m_accessMode) - << ", open mode = " << asStringLiteral(m_openMode) - << ", baseAddressHint = " << logBaseAddressHint - << ", permissions = " << iox::log::oct(m_permissions.value()) << " ]"; + IOX_LOG(ERROR, + "Unable to create a shared memory object with the following properties [ name = " + << m_name << ", sizeInBytes = " << m_memorySizeInBytes + << ", access mode = " << asStringLiteral(m_accessMode) + << ", open mode = " << asStringLiteral(m_openMode) << ", baseAddressHint = " << logBaseAddressHint + << ", permissions = " << iox::log::oct(m_permissions.value()) << " ]"); }; auto sharedMemory = SharedMemoryBuilder() @@ -89,7 +89,7 @@ expected SharedMemoryObjectBuilder: if (!sharedMemory) { printErrorDetails(); - IOX_LOG(ERROR) << "Unable to create SharedMemoryObject since we could not acquire a SharedMemory resource"; + IOX_LOG(ERROR, "Unable to create SharedMemoryObject since we could not acquire a SharedMemory resource"); return err(SharedMemoryObjectError::SHARED_MEMORY_CREATION_FAILED); } @@ -97,8 +97,9 @@ expected SharedMemoryObjectBuilder: if (!realSizeResult) { printErrorDetails(); - IOX_LOG(ERROR) << "Unable to create SharedMemoryObject since we could not acquire the memory size of the " - "underlying object."; + IOX_LOG(ERROR, + "Unable to create SharedMemoryObject since we could not acquire the memory size of the " + "underlying object."); return err(SharedMemoryObjectError::UNABLE_TO_VERIFY_MEMORY_SIZE); } @@ -106,8 +107,9 @@ expected SharedMemoryObjectBuilder: if (realSize < m_memorySizeInBytes) { printErrorDetails(); - IOX_LOG(ERROR) << "Unable to create SharedMemoryObject since a size of " << m_memorySizeInBytes - << " was requested but the object has only a size of " << realSize; + IOX_LOG(ERROR, + "Unable to create SharedMemoryObject since a size of " + << m_memorySizeInBytes << " was requested but the object has only a size of " << realSize); return err(SharedMemoryObjectError::REQUESTED_SIZE_EXCEEDS_ACTUAL_SIZE); } @@ -123,14 +125,13 @@ expected SharedMemoryObjectBuilder: if (!memoryMap) { printErrorDetails(); - IOX_LOG(ERROR) << "Failed to map created shared memory into process!"; + IOX_LOG(ERROR, "Failed to map created shared memory into process!"); return err(SharedMemoryObjectError::MAPPING_SHARED_MEMORY_FAILED); } if (sharedMemory->hasOwnership()) { - IOX_LOG(DEBUG) << "Trying to reserve " << m_memorySizeInBytes << " bytes in the shared memory [" << m_name - << "]"; + IOX_LOG(DEBUG, "Trying to reserve " << m_memorySizeInBytes << " bytes in the shared memory [" << m_name << "]"); if (platform::IOX_SHM_WRITE_ZEROS_ON_CREATION) { // this lock is required for the case that multiple threads are creating multiple @@ -140,7 +141,7 @@ expected SharedMemoryObjectBuilder: if (memsetSigbusGuard.has_error()) { printErrorDetails(); - IOX_LOG(ERROR) << "Failed to temporarily override SIGBUS to safely zero the shared memory"; + IOX_LOG(ERROR, "Failed to temporarily override SIGBUS to safely zero the shared memory"); return err(SharedMemoryObjectError::INTERNAL_LOGIC_FAILURE); } @@ -163,8 +164,8 @@ expected SharedMemoryObjectBuilder: memset(memoryMap->getBaseAddress(), 0, m_memorySizeInBytes); } - IOX_LOG(DEBUG) << "Acquired " << m_memorySizeInBytes << " bytes successfully in the shared memory [" << m_name - << "]"; + IOX_LOG(DEBUG, + "Acquired " << m_memorySizeInBytes << " bytes successfully in the shared memory [" << m_name << "]"); } return ok(SharedMemoryObject(std::move(*sharedMemory), std::move(*memoryMap))); diff --git a/iceoryx_hoofs/source/posix_wrapper/shared_memory_object/memory_map.cpp b/iceoryx_hoofs/source/posix_wrapper/shared_memory_object/memory_map.cpp index 60656cb324c..4bd4eea8dc9 100644 --- a/iceoryx_hoofs/source/posix_wrapper/shared_memory_object/memory_map.cpp +++ b/iceoryx_hoofs/source/posix_wrapper/shared_memory_object/memory_map.cpp @@ -49,11 +49,12 @@ expected MemoryMapBuilder::create() noexcept } constexpr uint64_t FLAGS_BIT_SIZE = 32U; - IOX_LOG(ERROR) << "Unable to map memory with the following properties [ baseAddressHint = " - << iox::log::hex(m_baseAddressHint) << ", length = " << m_length - << ", fileDescriptor = " << m_fileDescriptor << ", access mode = " << asStringLiteral(m_accessMode) - << ", flags = " << std::bitset(static_cast(m_flags)).to_string() - << ", offset = " << iox::log::hex(m_offset) << " ]"; + IOX_LOG(ERROR, + "Unable to map memory with the following properties [ baseAddressHint = " + << iox::log::hex(m_baseAddressHint) << ", length = " << m_length + << ", fileDescriptor = " << m_fileDescriptor << ", access mode = " << asStringLiteral(m_accessMode) + << ", flags = " << std::bitset(static_cast(m_flags)).to_string() + << ", offset = " << iox::log::hex(m_offset) << " ]"); return err(MemoryMap::errnoToEnum(result.error().errnum)); } @@ -63,63 +64,69 @@ MemoryMap::MemoryMap(void* const baseAddress, const uint64_t length) noexcept { } + +// NOLINTJUSTIFICATION the function size results from the error handling and the expanded log macro +// NOLINTNEXTLINE(readability-function-size) MemoryMapError MemoryMap::errnoToEnum(const int32_t errnum) noexcept { switch (errnum) { case EACCES: - IOX_LOG(ERROR) - << "One or more of the following failures happened:\n" - << " 1. The file descriptor belongs to a non-regular file.\n" - << " 2. The file descriptor is not opened for reading.\n" - << " 3. MAP_SHARED is requested and PROT_WRITE is set but the file descriptor is not opened for writing.\n" - << " 4. PROT_WRITE is set but the file descriptor is set to append-only."; + IOX_LOG(ERROR, + "One or more of the following failures happened:\n" + << " 1. The file descriptor belongs to a non-regular file.\n" + << " 2. The file descriptor is not opened for reading.\n" + << " 3. MAP_SHARED is requested and PROT_WRITE is set but the file descriptor is not opened for " + "writing.\n" + << " 4. PROT_WRITE is set but the file descriptor is set to append-only."); return MemoryMapError::ACCESS_FAILED; case EAGAIN: - IOX_LOG(ERROR) << "Either too much memory has been locked or the file is already locked."; + IOX_LOG(ERROR, "Either too much memory has been locked or the file is already locked."); return MemoryMapError::UNABLE_TO_LOCK; case EBADF: - IOX_LOG(ERROR) << "Invalid file descriptor provided."; + IOX_LOG(ERROR, "Invalid file descriptor provided."); return MemoryMapError::INVALID_FILE_DESCRIPTOR; case EEXIST: - IOX_LOG(ERROR) << "The mapped range that is requested is overlapping with an already mapped memory range."; + IOX_LOG(ERROR, "The mapped range that is requested is overlapping with an already mapped memory range."); return MemoryMapError::MAP_OVERLAP; case EINVAL: - IOX_LOG(ERROR) << "One or more of the following failures happened:\n" - << " 1. The address, length or the offset is not aligned on a page boundary.\n" - << " 2. The provided length is 0.\n" - << " 3. One of the flags of MAP_PRIVATE, MAP_SHARED or MAP_SHARED_VALIDATE is missing."; + IOX_LOG(ERROR, + "One or more of the following failures happened:\n" + << " 1. The address, length or the offset is not aligned on a page boundary.\n" + << " 2. The provided length is 0.\n" + << " 3. One of the flags of MAP_PRIVATE, MAP_SHARED or MAP_SHARED_VALIDATE is missing."); return MemoryMapError::INVALID_PARAMETERS; case ENFILE: - IOX_LOG(ERROR) << "System limit of maximum open files reached"; + IOX_LOG(ERROR, "System limit of maximum open files reached"); return MemoryMapError::OPEN_FILES_SYSTEM_LIMIT_EXCEEDED; case ENODEV: - IOX_LOG(ERROR) << "Memory mappings are not supported by the underlying filesystem."; + IOX_LOG(ERROR, "Memory mappings are not supported by the underlying filesystem."); return MemoryMapError::FILESYSTEM_DOES_NOT_SUPPORT_MEMORY_MAPPING; case ENOMEM: - IOX_LOG(ERROR) - << "One or more of the following failures happened:\n" - << " 1. Not enough memory available.\n" - << " 2. The maximum supported number of mappings is exceeded.\n" - << " 3. Partial unmapping of an already mapped memory region dividing it into two parts.\n" - << " 4. The processes maximum size of data segments is exceeded.\n" - << " 5. The sum of the number of pages used for length and the pages used for offset would overflow " - "and unsigned long. (only 32-bit architecture)"; + IOX_LOG( + ERROR, + "One or more of the following failures happened:\n" + << " 1. Not enough memory available.\n" + << " 2. The maximum supported number of mappings is exceeded.\n" + << " 3. Partial unmapping of an already mapped memory region dividing it into two parts.\n" + << " 4. The processes maximum size of data segments is exceeded.\n" + << " 5. The sum of the number of pages used for length and the pages used for offset would overflow " + "and unsigned long. (only 32-bit architecture)"); return MemoryMapError::NOT_ENOUGH_MEMORY_AVAILABLE; case EOVERFLOW: - IOX_LOG(ERROR) << "The sum of the number of pages and offset are overflowing. (only 32-bit architecture)"; + IOX_LOG(ERROR, "The sum of the number of pages and offset are overflowing. (only 32-bit architecture)"); return MemoryMapError::OVERFLOWING_PARAMETERS; case EPERM: - IOX_LOG(ERROR) - << "One or more of the following failures happened:\n" - << " 1. Mapping a memory region with PROT_EXEC which belongs to a filesystem that has no-exec.\n" - << " 2. The corresponding file is sealed."; + IOX_LOG(ERROR, + "One or more of the following failures happened:\n" + << " 1. Mapping a memory region with PROT_EXEC which belongs to a filesystem that has no-exec.\n" + << " 2. The corresponding file is sealed."); return MemoryMapError::PERMISSION_FAILURE; case ETXTBSY: - IOX_LOG(ERROR) << "The memory region was set up with MAP_DENYWRITE but write access was requested."; + IOX_LOG(ERROR, "The memory region was set up with MAP_DENYWRITE but write access was requested."); return MemoryMapError::NO_WRITE_PERMISSION; default: - IOX_LOG(ERROR) << "This should never happened. An unknown error occurred!\n"; + IOX_LOG(ERROR, "This should never happened. An unknown error occurred!\n"); return MemoryMapError::UNKNOWN_ERROR; }; } @@ -135,7 +142,7 @@ MemoryMap& MemoryMap::operator=(MemoryMap&& rhs) noexcept { if (!destroy()) { - IOX_LOG(ERROR) << "move assignment failed to unmap mapped memory"; + IOX_LOG(ERROR, "move assignment failed to unmap mapped memory"); } m_baseAddress = rhs.m_baseAddress; @@ -151,7 +158,7 @@ MemoryMap::~MemoryMap() noexcept { if (!destroy()) { - IOX_LOG(ERROR) << "destructor failed to unmap mapped memory"; + IOX_LOG(ERROR, "destructor failed to unmap mapped memory"); } } @@ -176,8 +183,9 @@ bool MemoryMap::destroy() noexcept if (unmapResult.has_error()) { errnoToEnum(unmapResult.error().errnum); - IOX_LOG(ERROR) << "unable to unmap mapped memory [ address = " << iox::log::hex(m_baseAddress) - << ", size = " << m_length << " ]"; + IOX_LOG(ERROR, + "unable to unmap mapped memory [ address = " << iox::log::hex(m_baseAddress) + << ", size = " << m_length << " ]"); return false; } } diff --git a/iceoryx_hoofs/source/posix_wrapper/shared_memory_object/shared_memory.cpp b/iceoryx_hoofs/source/posix_wrapper/shared_memory_object/shared_memory.cpp index f7bb55cf19d..f3a03ed4ae7 100644 --- a/iceoryx_hoofs/source/posix_wrapper/shared_memory_object/shared_memory.cpp +++ b/iceoryx_hoofs/source/posix_wrapper/shared_memory_object/shared_memory.cpp @@ -39,28 +39,31 @@ string addLeadingSlash(const SharedMemory: return nameWithLeadingSlash; } +// NOLINTJUSTIFICATION the function size and cognitive complexity results from the error handling and the expanded log macro +// NOLINTNEXTLINE(readability-function-size,readability-function-cognitive-complexity) expected SharedMemoryBuilder::create() noexcept { auto printError = [this] { - IOX_LOG(ERROR) << "Unable to create shared memory with the following properties [ name = " << m_name - << ", access mode = " << asStringLiteral(m_accessMode) - << ", open mode = " << asStringLiteral(m_openMode) - << ", mode = " << iox::log::oct(m_filePermissions.value()) << ", sizeInBytes = " << m_size - << " ]"; + IOX_LOG(ERROR, + "Unable to create shared memory with the following properties [ name = " + << m_name << ", access mode = " << asStringLiteral(m_accessMode) + << ", open mode = " << asStringLiteral(m_openMode) + << ", mode = " << iox::log::oct(m_filePermissions.value()) << ", sizeInBytes = " << m_size << " ]"); }; // on qnx the current working directory will be added to the /dev/shmem path if the leading slash is missing if (m_name.empty()) { - IOX_LOG(ERROR) << "No shared memory name specified!"; + IOX_LOG(ERROR, "No shared memory name specified!"); return err(SharedMemoryError::EMPTY_NAME); } if (!isValidFileName(m_name)) { - IOX_LOG(ERROR) << "Shared memory requires a valid file name (not path) as name and \"" << m_name - << "\" is not a valid file name"; + IOX_LOG(ERROR, + "Shared memory requires a valid file name (not path) as name and \"" << m_name + << "\" is not a valid file name"); return err(SharedMemoryError::INVALID_FILE_NAME); } @@ -71,8 +74,9 @@ expected SharedMemoryBuilder::create() noexcept if (hasOwnership && (m_accessMode == AccessMode::READ_ONLY)) { - IOX_LOG(ERROR) << "Cannot create shared-memory file \"" << m_name << "\" in read-only mode. " - << "Initializing a new file requires write access"; + IOX_LOG(ERROR, + "Cannot create shared-memory file \"" << m_name << "\" in read-only mode. " + << "Initializing a new file requires write access"); return err(SharedMemoryError::INCOMPATIBLE_OPEN_AND_ACCESS_MODE); } @@ -136,16 +140,18 @@ expected SharedMemoryBuilder::create() noexcept .failureReturnValue(SharedMemory::INVALID_HANDLE) .evaluate() .or_else([&](auto& r) { - IOX_LOG(ERROR) << "Unable to close filedescriptor (close failed) : " << r.getHumanReadableErrnum() - << " for SharedMemory \"" << m_name << "\""; + IOX_LOG(ERROR, + "Unable to close filedescriptor (close failed) : " + << r.getHumanReadableErrnum() << " for SharedMemory \"" << m_name << "\""); }); posixCall(iox_shm_unlink)(nameWithLeadingSlash.c_str()) .failureReturnValue(SharedMemory::INVALID_HANDLE) .evaluate() .or_else([&](auto&) { - IOX_LOG(ERROR) << "Unable to remove previously created SharedMemory \"" << m_name - << "\". This may be a SharedMemory leak."; + IOX_LOG(ERROR, + "Unable to remove previously created SharedMemory \"" + << m_name << "\". This may be a SharedMemory leak."); }); return err(SharedMemory::errnoToEnum(result.error().errnum)); @@ -239,7 +245,7 @@ bool SharedMemory::unlink() noexcept auto unlinkResult = unlinkIfExist(m_name); if (unlinkResult.has_error() || !unlinkResult.value()) { - IOX_LOG(ERROR) << "Unable to unlink SharedMemory (shm_unlink failed)."; + IOX_LOG(ERROR, "Unable to unlink SharedMemory (shm_unlink failed)."); return false; } m_hasOwnership = false; @@ -255,8 +261,8 @@ bool SharedMemory::close() noexcept { auto call = posixCall(iox_shm_close)(m_handle).failureReturnValue(INVALID_HANDLE).evaluate().or_else([](auto& r) { - IOX_LOG(ERROR) << "Unable to close SharedMemory filedescriptor (close failed) : " - << r.getHumanReadableErrnum(); + IOX_LOG(ERROR, + "Unable to close SharedMemory filedescriptor (close failed) : " << r.getHumanReadableErrnum()); }); m_handle = INVALID_HANDLE; @@ -265,49 +271,52 @@ bool SharedMemory::close() noexcept return true; } +// NOLINTJUSTIFICATION the function size and cognitive complexity results from the error handling and the expanded log macro +// NOLINTNEXTLINE(readability-function-size,readability-function-cognitive-complexity) SharedMemoryError SharedMemory::errnoToEnum(const int32_t errnum) noexcept { switch (errnum) { case EACCES: - IOX_LOG(ERROR) << "No permission to modify, truncate or access the shared memory!"; + IOX_LOG(ERROR, "No permission to modify, truncate or access the shared memory!"); return SharedMemoryError::INSUFFICIENT_PERMISSIONS; case EPERM: - IOX_LOG(ERROR) << "Resizing a file beyond its current size is not supported by the filesystem!"; + IOX_LOG(ERROR, "Resizing a file beyond its current size is not supported by the filesystem!"); return SharedMemoryError::NO_RESIZE_SUPPORT; case EFBIG: - IOX_LOG(ERROR) << "Requested Shared Memory is larger then the maximum file size."; + IOX_LOG(ERROR, "Requested Shared Memory is larger then the maximum file size."); return SharedMemoryError::REQUESTED_MEMORY_EXCEEDS_MAXIMUM_FILE_SIZE; case EINVAL: - IOX_LOG(ERROR) << "Requested Shared Memory is larger then the maximum file size or the filedescriptor does not " - "belong to a regular file."; + IOX_LOG(ERROR, + "Requested Shared Memory is larger then the maximum file size or the filedescriptor does not " + "belong to a regular file."); return SharedMemoryError::REQUESTED_MEMORY_EXCEEDS_MAXIMUM_FILE_SIZE; case EBADF: - IOX_LOG(ERROR) << "Provided filedescriptor is not a valid filedescriptor."; + IOX_LOG(ERROR, "Provided filedescriptor is not a valid filedescriptor."); return SharedMemoryError::INVALID_FILEDESCRIPTOR; case EEXIST: - IOX_LOG(ERROR) << "A Shared Memory with the given name already exists."; + IOX_LOG(ERROR, "A Shared Memory with the given name already exists."); return SharedMemoryError::DOES_EXIST; case EISDIR: - IOX_LOG(ERROR) << "The requested Shared Memory file is a directory."; + IOX_LOG(ERROR, "The requested Shared Memory file is a directory."); return SharedMemoryError::PATH_IS_A_DIRECTORY; case ELOOP: - IOX_LOG(ERROR) << "Too many symbolic links encountered while traversing the path."; + IOX_LOG(ERROR, "Too many symbolic links encountered while traversing the path."); return SharedMemoryError::TOO_MANY_SYMBOLIC_LINKS; case EMFILE: - IOX_LOG(ERROR) << "Process limit of maximum open files reached."; + IOX_LOG(ERROR, "Process limit of maximum open files reached."); return SharedMemoryError::PROCESS_LIMIT_OF_OPEN_FILES_REACHED; case ENFILE: - IOX_LOG(ERROR) << "System limit of maximum open files reached."; + IOX_LOG(ERROR, "System limit of maximum open files reached."); return SharedMemoryError::SYSTEM_LIMIT_OF_OPEN_FILES_REACHED; case ENOENT: - IOX_LOG(ERROR) << "Shared Memory does not exist."; + IOX_LOG(ERROR, "Shared Memory does not exist."); return SharedMemoryError::DOES_NOT_EXIST; case ENOMEM: - IOX_LOG(ERROR) << "Not enough memory available to create shared memory."; + IOX_LOG(ERROR, "Not enough memory available to create shared memory."); return SharedMemoryError::NOT_ENOUGH_MEMORY_AVAILABLE; default: - IOX_LOG(ERROR) << "This should never happen! An unknown error occurred!"; + IOX_LOG(ERROR, "This should never happen! An unknown error occurred!"); return SharedMemoryError::UNKNOWN_ERROR; } } diff --git a/iceoryx_hoofs/source/posix_wrapper/signal_handler.cpp b/iceoryx_hoofs/source/posix_wrapper/signal_handler.cpp index 3856cf05108..cebeb7d8032 100644 --- a/iceoryx_hoofs/source/posix_wrapper/signal_handler.cpp +++ b/iceoryx_hoofs/source/posix_wrapper/signal_handler.cpp @@ -50,7 +50,7 @@ void SignalGuard::restorePreviousAction() noexcept posixCall(sigaction)(static_cast(m_signal), &m_previousAction, nullptr) .successReturnValue(0) .evaluate() - .or_else([](auto&) { IOX_LOG(ERROR) << "Unable to restore the previous signal handling state!"; }); + .or_else([](auto&) { IOX_LOG(ERROR, "Unable to restore the previous signal handling state!"); }); } } @@ -63,10 +63,10 @@ expected registerSignalHandler(const Signal signa // sigemptyset fails when a nullptr is provided and this should never happen with this logic if (posixCall(sigemptyset)(&action.sa_mask).successReturnValue(0).evaluate().has_error()) { - IOX_LOG(ERROR) - << "This should never happen! Unable to create an empty sigaction set while registering a signal " - "handler for the signal [" - << static_cast(signal) << "]. No signal handler will be registered!"; + IOX_LOG(ERROR, + "This should never happen! Unable to create an empty sigaction set while registering a signal handler " + "for the signal [" + << static_cast(signal) << "]. No signal handler will be registered!"); return err(SignalGuardError::INVALID_SIGNAL_ENUM_VALUE); } @@ -85,9 +85,9 @@ expected registerSignalHandler(const Signal signa .evaluate() .has_error()) { - IOX_LOG(ERROR) - << "This should never happen! An error occurred while registering a signal handler for the signal [" - << static_cast(signal) << "]. "; + IOX_LOG(ERROR, + "This should never happen! An error occurred while registering a signal handler for the signal [" + << static_cast(signal) << "]. "); return err(SignalGuardError::UNDEFINED_ERROR_IN_SYSTEM_CALL); } diff --git a/iceoryx_hoofs/source/posix_wrapper/system_configuration.cpp b/iceoryx_hoofs/source/posix_wrapper/system_configuration.cpp index 30c57511b00..6f95ce47d05 100644 --- a/iceoryx_hoofs/source/posix_wrapper/system_configuration.cpp +++ b/iceoryx_hoofs/source/posix_wrapper/system_configuration.cpp @@ -32,7 +32,7 @@ uint64_t pageSize() noexcept .failureReturnValue(-1) .evaluate() .or_else([](auto& r) { - IOX_LOG(ERROR) << "This should never happen: " << r.getHumanReadableErrnum(); + IOX_LOG(ERROR, "This should never happen: " << r.getHumanReadableErrnum()); cxx::Ensures(false && "Internal logic error"); }) .value() diff --git a/iceoryx_hoofs/source/posix_wrapper/thread.cpp b/iceoryx_hoofs/source/posix_wrapper/thread.cpp index f15fb2f310b..d7e8d2a3017 100644 --- a/iceoryx_hoofs/source/posix_wrapper/thread.cpp +++ b/iceoryx_hoofs/source/posix_wrapper/thread.cpp @@ -27,7 +27,7 @@ void setThreadName(std::thread::native_handle_type thread, const ThreadName_t& n posixCall(iox_pthread_setname_np)(thread, name.c_str()).successReturnValue(0).evaluate().or_else([](auto& r) { // String length limit is ensured through iox::string // ERANGE (string too long) intentionally not handled to avoid untestable and dead code - IOX_LOG(ERROR) << "This should never happen! " << r.getHumanReadableErrnum(); + IOX_LOG(ERROR, "This should never happen! " << r.getHumanReadableErrnum()); cxx::Ensures(false && "internal logic error"); }); } @@ -44,7 +44,7 @@ ThreadName_t getThreadName(std::thread::native_handle_type thread) noexcept .or_else([](auto& r) { // String length limit is ensured through MAX_THREAD_NAME_LENGTH // ERANGE (string too small) intentionally not handled to avoid untestable and dead code - IOX_LOG(ERROR) << "This should never happen! " << r.getHumanReadableErrnum(); + IOX_LOG(ERROR, "This should never happen! " << r.getHumanReadableErrnum()); cxx::Ensures(false && "internal logic error"); }); @@ -91,10 +91,10 @@ Thread::~Thread() noexcept switch (joinResult.error().errnum) { case EDEADLK: - IOX_LOG(ERROR) << "A deadlock was detected when attempting to join the thread."; + IOX_LOG(ERROR, "A deadlock was detected when attempting to join the thread."); break; default: - IOX_LOG(ERROR) << "This should never happen. An unknown error occurred."; + IOX_LOG(ERROR, "This should never happen. An unknown error occurred."); break; } } @@ -113,19 +113,19 @@ ThreadError Thread::errnoToEnum(const int errnoValue) noexcept case EAGAIN: /// @todo iox-#1365 add thread name to log message once the name is set via BUILDER_PARAMETER, maybe add both, /// the name of the new thread and the name of the thread which created the new one - IOX_LOG(ERROR) << "insufficient resources to create another thread"; + IOX_LOG(ERROR, "insufficient resources to create another thread"); return ThreadError::INSUFFICIENT_RESOURCES; case EINVAL: - IOX_LOG(ERROR) << "invalid attribute settings"; + IOX_LOG(ERROR, "invalid attribute settings"); return ThreadError::INVALID_ATTRIBUTES; case ENOMEM: - IOX_LOG(ERROR) << "not enough memory to initialize the thread attributes object"; + IOX_LOG(ERROR, "not enough memory to initialize the thread attributes object"); return ThreadError::INSUFFICIENT_MEMORY; case EPERM: - IOX_LOG(ERROR) << "no appropriate permission to set required scheduling policy or parameters"; + IOX_LOG(ERROR, "no appropriate permission to set required scheduling policy or parameters"); return ThreadError::INSUFFICIENT_PERMISSIONS; default: - IOX_LOG(ERROR) << "an unexpected error occurred in thread - this should never happen!"; + IOX_LOG(ERROR, "an unexpected error occurred in thread - this should never happen!"); return ThreadError::UNDEFINED; } } @@ -139,7 +139,7 @@ void* Thread::startRoutine(void* callable) .successReturnValue(0) .evaluate() .or_else([&self](auto&) { - IOX_LOG(WARN) << "failed to set thread name " << self->m_threadName; + IOX_LOG(WARN, "failed to set thread name " << self->m_threadName); self->m_threadName.clear(); }); diff --git a/iceoryx_hoofs/source/posix_wrapper/types.cpp b/iceoryx_hoofs/source/posix_wrapper/types.cpp index bb01f49b5a5..6dc16030382 100644 --- a/iceoryx_hoofs/source/posix_wrapper/types.cpp +++ b/iceoryx_hoofs/source/posix_wrapper/types.cpp @@ -35,7 +35,7 @@ int convertToOflags(const AccessMode accessMode) noexcept return O_WRONLY; } - IOX_LOG(ERROR) << "Unable to convert to O_ flag since an undefined iox::posix::AccessMode was provided"; + IOX_LOG(ERROR, "Unable to convert to O_ flag since an undefined iox::posix::AccessMode was provided"); return 0; } @@ -55,7 +55,7 @@ int convertToOflags(const OpenMode openMode) noexcept return O_CREAT | O_EXCL; } - IOX_LOG(ERROR) << "Unable to convert to O_ flag since an undefined iox::posix::OpenMode was provided"; + IOX_LOG(ERROR, "Unable to convert to O_ flag since an undefined iox::posix::OpenMode was provided"); return 0; } @@ -72,7 +72,7 @@ int convertToProtFlags(const AccessMode accessMode) noexcept return PROT_WRITE; } - IOX_LOG(ERROR) << "Unable to convert to PROT_ flag since an undefined iox::posix::AccessMode was provided"; + IOX_LOG(ERROR, "Unable to convert to PROT_ flag since an undefined iox::posix::AccessMode was provided"); return PROT_NONE; } diff --git a/iceoryx_hoofs/source/posix_wrapper/unix_domain_socket.cpp b/iceoryx_hoofs/source/posix_wrapper/unix_domain_socket.cpp index 372f5aa2afb..f8f13de1811 100644 --- a/iceoryx_hoofs/source/posix_wrapper/unix_domain_socket.cpp +++ b/iceoryx_hoofs/source/posix_wrapper/unix_domain_socket.cpp @@ -109,8 +109,8 @@ expected UnixDomainSocketBuilderNoPathPrefix: if (bindCall.has_error()) { UnixDomainSocket::closeFileDescriptor(m_name, sockfd, sockAddr, m_channelSide).or_else([](auto) { - IOX_LOG(ERROR) - << "Unable to close socket file descriptor in error related cleanup during initialization."; + IOX_LOG(ERROR, + "Unable to close socket file descriptor in error related cleanup during initialization."); }); // possible errors in closeFileDescriptor() are masked and we inform the user about the actual error return err(UnixDomainSocket::errnoToEnum(m_name, bindCall.error().errnum)); @@ -130,7 +130,7 @@ expected UnixDomainSocketBuilderNoPathPrefix: if (connectCall.has_error()) { UnixDomainSocket::closeFileDescriptor(m_name, sockfd, sockAddr, m_channelSide).or_else([](auto) { - IOX_LOG(ERROR) << "Unable to close socket file descriptor in error related cleanup during initialization."; + IOX_LOG(ERROR, "Unable to close socket file descriptor in error related cleanup during initialization."); }); // possible errors in closeFileDescriptor() are masked and we inform the user about the actual error return err(UnixDomainSocket::errnoToEnum(m_name, connectCall.error().errnum)); @@ -160,7 +160,7 @@ UnixDomainSocket::~UnixDomainSocket() noexcept { if (destroy().has_error()) { - IOX_LOG(ERROR) << "unable to cleanup unix domain socket \"" << m_name << "\" in the destructor"; + IOX_LOG(ERROR, "unable to cleanup unix domain socket \"" << m_name << "\" in the destructor"); } } @@ -175,8 +175,9 @@ UnixDomainSocket& UnixDomainSocket::operator=(UnixDomainSocket&& other) noexcept { if (destroy().has_error()) { - IOX_LOG(ERROR) << "Unable to cleanup unix domain socket \"" << m_name - << "\" in the move constructor/move assignment operator"; + IOX_LOG(ERROR, + "Unable to cleanup unix domain socket \"" << m_name + << "\" in the move constructor/move assignment operator"); } m_name = std::move(other.m_name); @@ -288,7 +289,7 @@ expected UnixDomainSocket::timedSend(const std::string& m if (IpcChannelSide::SERVER == m_channelSide) { - IOX_LOG(ERROR) << "sending on server side not supported for unix domain socket \"" << m_name << "\""; + IOX_LOG(ERROR, "sending on server side not supported for unix domain socket \"" << m_name << "\""); return err(IpcChannelError::INTERNAL_LOGIC_ERROR); } @@ -328,7 +329,7 @@ expected UnixDomainSocket::timedReceive(const unit { if (IpcChannelSide::CLIENT == m_channelSide) { - IOX_LOG(ERROR) << "receiving on client side not supported for unix domain socket \"" << m_name << "\""; + IOX_LOG(ERROR, "receiving on client side not supported for unix domain socket \"" << m_name << "\""); return err(IpcChannelError::INTERNAL_LOGIC_ERROR); } @@ -364,88 +365,90 @@ IpcChannelError UnixDomainSocket::errnoToEnum(const int32_t errnum) const noexce return errnoToEnum(m_name, errnum); } +// NOLINTJUSTIFICATION the function size and cognitive complexity results from the error handling and the expanded log macro +// NOLINTNEXTLINE(readability-function-size,readability-function-cognitive-complexity) IpcChannelError UnixDomainSocket::errnoToEnum(const UdsName_t& name, const int32_t errnum) noexcept { switch (errnum) { case EACCES: { - IOX_LOG(ERROR) << "permission to create unix domain socket denied \"" << name << "\""; + IOX_LOG(ERROR, "permission to create unix domain socket denied \"" << name << "\""); return IpcChannelError::ACCESS_DENIED; } case EAFNOSUPPORT: { - IOX_LOG(ERROR) << "address family not supported for unix domain socket \"" << name << "\""; + IOX_LOG(ERROR, "address family not supported for unix domain socket \"" << name << "\""); return IpcChannelError::INVALID_ARGUMENTS; } case EINVAL: { - IOX_LOG(ERROR) << "provided invalid arguments for unix domain socket \"" << name << "\""; + IOX_LOG(ERROR, "provided invalid arguments for unix domain socket \"" << name << "\""); return IpcChannelError::INVALID_ARGUMENTS; } case EMFILE: { - IOX_LOG(ERROR) << "process limit reached for unix domain socket \"" << name << "\""; + IOX_LOG(ERROR, "process limit reached for unix domain socket \"" << name << "\""); return IpcChannelError::PROCESS_LIMIT; } case ENFILE: { - IOX_LOG(ERROR) << "system limit reached for unix domain socket \"" << name << "\""; + IOX_LOG(ERROR, "system limit reached for unix domain socket \"" << name << "\""); return IpcChannelError::SYSTEM_LIMIT; } case ENOBUFS: { - IOX_LOG(ERROR) << "queue is full for unix domain socket \"" << name << "\""; + IOX_LOG(ERROR, "queue is full for unix domain socket \"" << name << "\""); return IpcChannelError::OUT_OF_MEMORY; } case ENOMEM: { - IOX_LOG(ERROR) << "out of memory for unix domain socket \"" << name << "\""; + IOX_LOG(ERROR, "out of memory for unix domain socket \"" << name << "\""); return IpcChannelError::OUT_OF_MEMORY; } case EPROTONOSUPPORT: { - IOX_LOG(ERROR) << "protocol type not supported for unix domain socket \"" << name << "\""; + IOX_LOG(ERROR, "protocol type not supported for unix domain socket \"" << name << "\""); return IpcChannelError::INVALID_ARGUMENTS; } case EADDRINUSE: { - IOX_LOG(ERROR) << "unix domain socket already in use \"" << name << "\""; + IOX_LOG(ERROR, "unix domain socket already in use \"" << name << "\""); return IpcChannelError::CHANNEL_ALREADY_EXISTS; } case EBADF: { - IOX_LOG(ERROR) << "invalid file descriptor for unix domain socket \"" << name << "\""; + IOX_LOG(ERROR, "invalid file descriptor for unix domain socket \"" << name << "\""); return IpcChannelError::INVALID_FILE_DESCRIPTOR; } case ENOTSOCK: { - IOX_LOG(ERROR) << "invalid unix domain socket \"" << name << "\""; + IOX_LOG(ERROR, "invalid unix domain socket \"" << name << "\""); return IpcChannelError::INVALID_FILE_DESCRIPTOR; } case EADDRNOTAVAIL: { - IOX_LOG(ERROR) << "interface or address error for unix domain socket \"" << name << "\""; + IOX_LOG(ERROR, "interface or address error for unix domain socket \"" << name << "\""); return IpcChannelError::INVALID_CHANNEL_NAME; } case EFAULT: { - IOX_LOG(ERROR) << "outside address space error for unix domain socket \"" << name << "\""; + IOX_LOG(ERROR, "outside address space error for unix domain socket \"" << name << "\""); return IpcChannelError::INVALID_CHANNEL_NAME; } case ELOOP: { - IOX_LOG(ERROR) << "too many symbolic links for unix domain socket \"" << name << "\""; + IOX_LOG(ERROR, "too many symbolic links for unix domain socket \"" << name << "\""); return IpcChannelError::INVALID_CHANNEL_NAME; } case ENAMETOOLONG: { - IOX_LOG(ERROR) << "name too long for unix domain socket \"" << name << "\""; + IOX_LOG(ERROR, "name too long for unix domain socket \"" << name << "\""); return IpcChannelError::INVALID_CHANNEL_NAME; } case ENOTDIR: { - IOX_LOG(ERROR) << "not a directory error for unix domain socket \"" << name << "\""; + IOX_LOG(ERROR, "not a directory error for unix domain socket \"" << name << "\""); return IpcChannelError::INVALID_CHANNEL_NAME; } case ENOENT: @@ -455,17 +458,17 @@ IpcChannelError UnixDomainSocket::errnoToEnum(const UdsName_t& name, const int32 } case EROFS: { - IOX_LOG(ERROR) << "read only error for unix domain socket \"" << name << "\""; + IOX_LOG(ERROR, "read only error for unix domain socket \"" << name << "\""); return IpcChannelError::INVALID_CHANNEL_NAME; } case EIO: { - IOX_LOG(ERROR) << "I/O for unix domain socket \"" << name << "\""; + IOX_LOG(ERROR, "I/O for unix domain socket \"" << name << "\""); return IpcChannelError::I_O_ERROR; } case ENOPROTOOPT: { - IOX_LOG(ERROR) << "invalid option for unix domain socket \"" << name << "\""; + IOX_LOG(ERROR, "invalid option for unix domain socket \"" << name << "\""); return IpcChannelError::INVALID_ARGUMENTS; } case ECONNREFUSED: @@ -475,7 +478,7 @@ IpcChannelError UnixDomainSocket::errnoToEnum(const UdsName_t& name, const int32 } case ECONNRESET: { - IOX_LOG(ERROR) << "connection was reset by peer for \"" << name << "\""; + IOX_LOG(ERROR, "connection was reset by peer for \"" << name << "\""); return IpcChannelError::CONNECTION_RESET_BY_PEER; } case EWOULDBLOCK: @@ -485,7 +488,7 @@ IpcChannelError UnixDomainSocket::errnoToEnum(const UdsName_t& name, const int32 } default: { - IOX_LOG(ERROR) << "internal logic error in unix domain socket \"" << name << "\" occurred"; + IOX_LOG(ERROR, "internal logic error in unix domain socket \"" << name << "\" occurred"); return IpcChannelError::INTERNAL_LOGIC_ERROR; } } diff --git a/iceoryx_hoofs/source/posix_wrapper/unnamed_semaphore.cpp b/iceoryx_hoofs/source/posix_wrapper/unnamed_semaphore.cpp index 063f69b8ca7..8fb5864855b 100644 --- a/iceoryx_hoofs/source/posix_wrapper/unnamed_semaphore.cpp +++ b/iceoryx_hoofs/source/posix_wrapper/unnamed_semaphore.cpp @@ -27,8 +27,9 @@ UnnamedSemaphoreBuilder::create(optional& uninitializedSemapho { if (m_initialValue > IOX_SEM_VALUE_MAX) { - IOX_LOG(ERROR) << "The unnamed semaphore initial value of " << m_initialValue - << " exceeds the maximum semaphore value " << IOX_SEM_VALUE_MAX; + IOX_LOG(ERROR, + "The unnamed semaphore initial value of " << m_initialValue << " exceeds the maximum semaphore value " + << IOX_SEM_VALUE_MAX); return err(SemaphoreError::SEMAPHORE_OVERFLOW); } @@ -48,13 +49,13 @@ UnnamedSemaphoreBuilder::create(optional& uninitializedSemapho switch (result.error().errnum) { case EINVAL: - IOX_LOG(ERROR) << "The initial value of " << m_initialValue << " exceeds " << IOX_SEM_VALUE_MAX; + IOX_LOG(ERROR, "The initial value of " << m_initialValue << " exceeds " << IOX_SEM_VALUE_MAX); break; case ENOSYS: - IOX_LOG(ERROR) << "The system does not support process-shared semaphores"; + IOX_LOG(ERROR, "The system does not support process-shared semaphores"); break; default: - IOX_LOG(ERROR) << "This should never happen. An unknown error occurred."; + IOX_LOG(ERROR, "This should never happen. An unknown error occurred."); break; } } @@ -72,10 +73,10 @@ UnnamedSemaphore::~UnnamedSemaphore() noexcept switch (result.error().errnum) { case EINVAL: - IOX_LOG(ERROR) << "The semaphore handle was no longer valid. This can indicate a corrupted system."; + IOX_LOG(ERROR, "The semaphore handle was no longer valid. This can indicate a corrupted system."); break; default: - IOX_LOG(ERROR) << "This should never happen. An unknown error occurred."; + IOX_LOG(ERROR, "This should never happen. An unknown error occurred."); break; } } diff --git a/iceoryx_hoofs/test/moduletests/test_posix_access_rights.cpp b/iceoryx_hoofs/test/moduletests/test_posix_access_rights.cpp index 92d7a99ea9c..a4f478c9e41 100644 --- a/iceoryx_hoofs/test/moduletests/test_posix_access_rights.cpp +++ b/iceoryx_hoofs/test/moduletests/test_posix_access_rights.cpp @@ -41,7 +41,7 @@ class PosixAccessRights_test : public Test .failureReturnValue(-1) .evaluate() .or_else([](auto& r) { - IOX_LOG(ERROR) << "system call failed with error: " << r.getHumanReadableErrnum(); + IOX_LOG(ERROR, "system call failed with error: " << r.getHumanReadableErrnum()); std::terminate(); }); } @@ -50,8 +50,8 @@ class PosixAccessRights_test : public Test { if (std::remove(TestFileName.c_str()) != 0) { - IOX_LOG(ERROR) << "Failed to remove temporary file '" << TestFileName - << "'. You'll have to remove it by yourself."; + IOX_LOG(ERROR, + "Failed to remove temporary file '" << TestFileName << "'. You'll have to remove it by yourself."); } } diff --git a/iceoryx_hoofs/test/moduletests/test_unix_domain_sockets.cpp b/iceoryx_hoofs/test/moduletests/test_unix_domain_sockets.cpp index 8ccc40f9473..2dcbefccc6f 100644 --- a/iceoryx_hoofs/test/moduletests/test_unix_domain_sockets.cpp +++ b/iceoryx_hoofs/test/moduletests/test_unix_domain_sockets.cpp @@ -82,12 +82,12 @@ class UnixDomainSocket_test : public Test .failureReturnValue(ERROR_CODE) .evaluate() .or_else([&](auto&) { - IOX_LOG(ERROR) << "unable to bind socket"; + IOX_LOG(ERROR, "unable to bind socket"); socketCreationSuccess = false; }); }) .or_else([&](auto&) { - IOX_LOG(ERROR) << "unable to create socket"; + IOX_LOG(ERROR, "unable to create socket"); socketCreationSuccess = false; }); return socketCreationSuccess; diff --git a/iceoryx_hoofs/test/stresstests/sofi/test_stress_sofi.cpp b/iceoryx_hoofs/test/stresstests/sofi/test_stress_sofi.cpp index 797bf8a45af..5a68af38f45 100644 --- a/iceoryx_hoofs/test/stresstests/sofi/test_stress_sofi.cpp +++ b/iceoryx_hoofs/test/stresstests/sofi/test_stress_sofi.cpp @@ -57,7 +57,7 @@ class SoFiStress : public Test auto retVal = pthread_setaffinity_np(nativeHandle, sizeof(cpu_set_t), &cpuset); if (retVal != 0) { - IOX_LOG(ERROR) << "Error calling pthread_setaffinity_np: " << retVal << "; errno: " << errno; + IOX_LOG(ERROR, "Error calling pthread_setaffinity_np: " << retVal << "; errno: " << errno); return false; } #else @@ -195,8 +195,8 @@ TEST_F(SoFiStress, SimultaneouslyPushAndPopOnEmptySoFi) << "There should be at least 4 times as many trys to pop as actual pops!"; EXPECT_THAT(pushCounter, Eq(popCounter)) << "Push and Pop Counter should be Equal after the Test!"; - IOX_LOG(INFO) << "try pop counter: " << tryPopCounter; - IOX_LOG(INFO) << "pop counter : " << pushCounter; + IOX_LOG(INFO, "try pop counter: " << tryPopCounter); + IOX_LOG(INFO, "pop counter : " << pushCounter); } /// @brief This tests a fast pusher and slow popper. @@ -393,8 +393,8 @@ TEST_F(SoFiStress, PopFromContinuouslyOverflowingSoFi) EXPECT_THAT(pushCounter / 4, Gt(popCounter)) << "There should be at least 4 times as many pushes as pops!"; EXPECT_THAT(pushCounter, Eq(dataCounter)) << "Push and Data Counter should be Equal after the Test!"; - IOX_LOG(INFO) << "push counter: " << pushCounter; - IOX_LOG(INFO) << "pop counter : " << popCounter; + IOX_LOG(INFO, "push counter: " << pushCounter); + IOX_LOG(INFO, "pop counter : " << popCounter); } /// @brief This tests a fast pusher and fast popper. @@ -541,7 +541,7 @@ TEST_F(SoFiStress, PushAndPopFromNonOverflowingNonEmptySoFi) EXPECT_THAT(pushCounter / 1000, Gt(STRESS_TIME.count())) << "There should be at least 1000 pushes per millisecond!"; EXPECT_THAT(pushCounter, Eq(popCounter.load())) << "Push and Pop Counter should be Equal after the Test!"; - IOX_LOG(INFO) << "push & pop counter: " << pushCounter.load(); + IOX_LOG(INFO, "push & pop counter: " << pushCounter.load()); } int main(int argc, char* argv[]) diff --git a/iceoryx_hoofs/test/stresstests/test_lockfree_queue_stresstest.cpp b/iceoryx_hoofs/test/stresstests/test_lockfree_queue_stresstest.cpp index 5050b95dc69..58271d33808 100644 --- a/iceoryx_hoofs/test/stresstests/test_lockfree_queue_stresstest.cpp +++ b/iceoryx_hoofs/test/stresstests/test_lockfree_queue_stresstest.cpp @@ -47,7 +47,7 @@ struct Data void print() const { - IOX_LOG(INFO) << "data id " << id << " count " << count; + IOX_LOG(INFO, "data id " << id << " count " << count); } }; @@ -199,13 +199,13 @@ bool checkTwoConsumerResult(std::list& consumed1, if (!isStrictlyMonotonic(filtered1) || !isStrictlyMonotonic(filtered2)) { - IOX_LOG(INFO) << "id " << id << " not strictly monotonic"; + IOX_LOG(INFO, "id " << id << " not strictly monotonic"); return false; } if (!isComplete(filtered1, filtered2, expectedFinalCount)) { - IOX_LOG(INFO) << "id " << id << " incomplete"; + IOX_LOG(INFO, "id " << id << " incomplete"); return false; } } diff --git a/iceoryx_hoofs/time/include/iox/duration.hpp b/iceoryx_hoofs/time/include/iox/duration.hpp index b4aa39e7466..0e92ce3eab8 100644 --- a/iceoryx_hoofs/time/include/iox/duration.hpp +++ b/iceoryx_hoofs/time/include/iox/duration.hpp @@ -76,9 +76,9 @@ constexpr Duration operator"" _d(unsigned long long int value) noexcept; /// using namespace units::duration_literals; /// auto someDays = 2 * 7_d + 5_ns; /// auto someSeconds = 42_s + 500_ms; -/// IOX_LOG(INFO) << someDays; -/// IOX_LOG(INFO) << someDays.nanoSeconds() << " ns"; -/// IOX_LOG(INFO) << someSeconds.milliSeconds() << " ms"; +/// IOX_LOG(INFO, someDays); +/// IOX_LOG(INFO, someDays.nanoSeconds() << " ns"); +/// IOX_LOG(INFO, someSeconds.milliSeconds() << " ms"); /// @endcode class Duration { diff --git a/iceoryx_hoofs/time/source/duration.cpp b/iceoryx_hoofs/time/source/duration.cpp index 582f65b41cf..88b27c7956f 100644 --- a/iceoryx_hoofs/time/source/duration.cpp +++ b/iceoryx_hoofs/time/source/duration.cpp @@ -36,7 +36,7 @@ struct timespec Duration::timespec(const TimeSpecReference reference) const noex static_assert(sizeof(uint64_t) >= sizeof(SEC_TYPE), "casting might alter result"); if (this->m_seconds > static_cast(std::numeric_limits::max())) { - IOX_LOG(TRACE) << ": Result of conversion would overflow, clamping to max value!"; + IOX_LOG(TRACE, ": Result of conversion would overflow, clamping to max value!"); return {std::numeric_limits::max(), NANOSECS_PER_SEC - 1U}; } @@ -62,7 +62,7 @@ struct timespec Duration::timespec(const TimeSpecReference reference) const noex // AXIVION Next Construct AutosarC++19_03-M0.1.2, AutosarC++19_03-M0.1.9, FaultDetection-DeadBranches : False positive! Branching depends on input parameter if (targetTime.m_seconds > static_cast(std::numeric_limits::max())) { - IOX_LOG(TRACE) << ": Result of conversion would overflow, clamping to max value!"; + IOX_LOG(TRACE, ": Result of conversion would overflow, clamping to max value!"); return {std::numeric_limits::max(), NANOSECS_PER_SEC - 1U}; } diff --git a/iceoryx_hoofs/vocabulary/include/iox/detail/semantic_string.inl b/iceoryx_hoofs/vocabulary/include/iox/detail/semantic_string.inl index b4153462fc0..a6ab4026868 100644 --- a/iceoryx_hoofs/vocabulary/include/iox/detail/semantic_string.inl +++ b/iceoryx_hoofs/vocabulary/include/iox/detail/semantic_string.inl @@ -45,8 +45,9 @@ SemanticString Capacity) { - IOX_LOG(DEBUG) << "Unable to create semantic string since the value \"" << value - << "\" exceeds the maximum valid length of " << Capacity << "."; + IOX_LOG(DEBUG, + "Unable to create semantic string since the value \"" + << value << "\" exceeds the maximum valid length of " << Capacity << "."); return err(SemanticStringError::ExceedsMaximumLength); } @@ -54,15 +55,14 @@ SemanticString::string(TruncateToCapacity_t, const char* const other, c m_rawstring[Capacity] = '\0'; m_rawstringSize = Capacity; - IOX_LOG(WARN) << "Constructor truncates the last " << count - Capacity << " characters of " << other - << ", because the char array length is larger than the capacity."; + IOX_LOG(WARN, + "Constructor truncates the last " << count - Capacity << " characters of " << other + << ", because the char array length is larger than the capacity."); } else { @@ -170,8 +171,9 @@ inline string& string::operator=(const char (&rhs)[N]) noexc if (rhs[m_rawstringSize] != '\0') { - IOX_LOG(WARN) << "iox::string: Assignment of array which is not zero-terminated! Last value of array " - "overwritten with 0!"; + IOX_LOG(WARN, + "iox::string: Assignment of array which is not zero-terminated! Last value of array " + "overwritten with 0!"); } return *this; } @@ -206,8 +208,9 @@ inline bool string::unsafe_assign(const char* const str) noexcept const uint64_t strSize{strnlen(str, Capacity + 1U)}; if (Capacity < strSize) { - IOX_LOG(DEBUG) << "Assignment failed. The given cstring is larger (" << strSize << ") than the capacity (" - << Capacity << ") of the fixed string."; + IOX_LOG(DEBUG, + "Assignment failed. The given cstring is larger (" << strSize << ") than the capacity (" << Capacity + << ") of the fixed string."); return false; } std::memcpy(m_rawstring, str, strSize); @@ -369,7 +372,7 @@ inline IsStringOrCharArrayOrChar string::unsafe_append(const if (tSize > clampedTSize) { - IOX_LOG(DEBUG) << "Appending failed because the sum of sizes exceeds this' capacity."; + IOX_LOG(DEBUG, "Appending failed because the sum of sizes exceeds this' capacity."); return false; } @@ -393,8 +396,9 @@ inline IsStringOrCharArrayOrChar&> string::append( std::memcpy(&(m_rawstring[m_rawstringSize]), tData, clampedTSize); if (tSize > clampedTSize) { - IOX_LOG(WARN) << "The last " << (tSize - clampedTSize) << " characters of " << tData - << " are truncated, because the length is larger than the capacity."; + IOX_LOG(WARN, + "The last " << (tSize - clampedTSize) << " characters of " << tData + << " are truncated, because the length is larger than the capacity."); } m_rawstringSize += clampedTSize; @@ -409,8 +413,9 @@ inline string& string::append(TruncateToCapacity_t, char cst { if (m_rawstringSize == Capacity) { - IOX_LOG(WARN) << "Appending of " << static_cast(cstr) - << " failed because this' capacity would be exceeded."; + IOX_LOG(WARN, + "Appending of " << static_cast(cstr) + << " failed because this' capacity would be exceeded."); return *this; } m_rawstring[m_rawstringSize] = cstr; diff --git a/iceoryx_hoofs/vocabulary/include/iox/detail/variant.inl b/iceoryx_hoofs/vocabulary/include/iox/detail/variant.inl index ca071b87222..4c7c40e00b7 100644 --- a/iceoryx_hoofs/vocabulary/include/iox/detail/variant.inl +++ b/iceoryx_hoofs/vocabulary/include/iox/detail/variant.inl @@ -281,7 +281,7 @@ template // AXIVION Next Construct AutosarC++19_03-A3.9.1 : see at declaration in header inline void variant::error_message(const char* source, const char* msg) noexcept { - IOX_LOG(ERROR) << source << " ::: " << msg; + IOX_LOG(ERROR, source << " ::: " << msg); } template diff --git a/iceoryx_hoofs/vocabulary/include/iox/expected.hpp b/iceoryx_hoofs/vocabulary/include/iox/expected.hpp index 2ac8abf7d3e..12f4a529b48 100644 --- a/iceoryx_hoofs/vocabulary/include/iox/expected.hpp +++ b/iceoryx_hoofs/vocabulary/include/iox/expected.hpp @@ -291,7 +291,7 @@ class IOX_NO_DISCARD expected final : public FunctionalInterface frodo(ok(45)); /// *frodo += 12; - /// IOX_LOG(INFO) << *frodo; // prints 57 + /// IOX_LOG(INFO, *frodo); // prints 57 /// @endcode template enable_if_non_void_t& operator*() noexcept; @@ -304,7 +304,7 @@ class IOX_NO_DISCARD expected final : public FunctionalInterface frodo(ok(45)); /// *frodo += 12; - /// IOX_LOG(INFO) << *frodo; // prints 57 + /// IOX_LOG(INFO, *frodo); // prints 57 /// @endcode template const enable_if_non_void_t& operator*() const noexcept; diff --git a/iceoryx_hoofs/vocabulary/include/iox/variant.hpp b/iceoryx_hoofs/vocabulary/include/iox/variant.hpp index aa8d5406189..f1426595394 100644 --- a/iceoryx_hoofs/vocabulary/include/iox/variant.hpp +++ b/iceoryx_hoofs/vocabulary/include/iox/variant.hpp @@ -88,17 +88,17 @@ static constexpr uint64_t INVALID_VARIANT_INDEX{std::numeric_limits::m /// else if ( someVariant.index() == 1) /// { /// auto blubb = someVariant.template get_at_index<1>(); -/// IOX_LOG(INFO) << *blubb; +/// IOX_LOG(INFO, *blubb); /// /// auto sameAsBlubb = someVariant.get(); -/// IOX_LOG(INFO) << *sameAsBlubb; +/// IOX_LOG(INFO, *sameAsBlubb); /// } /// /// // .. do stuff /// /// int defaultValue = 123; /// int * fuu = someVariant.get_if(&defaultValue); -/// IOX_LOG(INFO) << *fuu; +/// IOX_LOG(INFO, *fuu); /// /// @endcode template diff --git a/iceoryx_posh/include/iceoryx_posh/internal/mepoo/mepoo_segment.inl b/iceoryx_posh/include/iceoryx_posh/internal/mepoo/mepoo_segment.inl index fddcbd6c581..ffa470da2f9 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/mepoo/mepoo_segment.inl +++ b/iceoryx_posh/include/iceoryx_posh/internal/mepoo/mepoo_segment.inl @@ -87,10 +87,11 @@ inline SharedMemoryObjectType MePooSegmentsetSegmentId(static_cast(maybeSegmentId.value())); - IOX_LOG(DEBUG) << "Roudi registered payload data segment " - << iox::log::hex(sharedMemoryObject.getBaseAddress()) << " with size " - << sharedMemoryObject.get_size().expect("Failed to get SHM size.") << " to id " - << m_segmentId; + IOX_LOG(DEBUG, + "Roudi registered payload data segment " + << iox::log::hex(sharedMemoryObject.getBaseAddress()) << " with size " + << sharedMemoryObject.get_size().expect("Failed to get SHM size.") << " to id " + << m_segmentId); }) .or_else([](auto&) { errorHandler(PoshError::MEPOO__SEGMENT_UNABLE_TO_CREATE_SHARED_MEMORY_OBJECT); }) .value()); diff --git a/iceoryx_posh/include/iceoryx_posh/internal/popo/base_client.inl b/iceoryx_posh/include/iceoryx_posh/internal/popo/base_client.inl index c560a16dac9..7fa9545d45e 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/popo/base_client.inl +++ b/iceoryx_posh/include/iceoryx_posh/internal/popo/base_client.inl @@ -106,10 +106,11 @@ inline void BaseClient::enableState(TriggerHandleT&& trig case ClientState::HAS_RESPONSE: if (m_trigger) { - IOX_LOG(WARN) - << "The client is already attached with either the ClientState::HAS_RESPONSE or " - "ClientEvent::RESPONSE_RECEIVED to a WaitSet/Listener. Detaching it from previous one and " - "attaching it to the new one with ClientState::HAS_RESPONSE. Best practice is to call detach first."; + IOX_LOG( + WARN, + "The client is already attached with either the ClientState::HAS_RESPONSE or " + "ClientEvent::RESPONSE_RECEIVED to a WaitSet/Listener. Detaching it from previous one and " + "attaching it to the new one with ClientState::HAS_RESPONSE. Best practice is to call detach first."); errorHandler( PoshError:: @@ -155,11 +156,11 @@ inline void BaseClient::enableEvent(TriggerHandleT&& trig case ClientEvent::RESPONSE_RECEIVED: if (m_trigger) { - IOX_LOG(WARN) - << "The client is already attached with either the ClientState::HAS_RESPONSE or " - "ClientEvent::RESPONSE_RECEIVED to a WaitSet/Listener. Detaching it from previous one and " - "attaching it to the new one with ClientEvent::RESPONSE_RECEIVED. Best practice is to call detach " - "first."; + IOX_LOG(WARN, + "The client is already attached with either the ClientState::HAS_RESPONSE or " + "ClientEvent::RESPONSE_RECEIVED to a WaitSet/Listener. Detaching it from previous one and " + "attaching it to the new one with ClientEvent::RESPONSE_RECEIVED. Best practice is to call detach " + "first."); errorHandler( PoshError:: POPO__BASE_CLIENT_OVERRIDING_WITH_EVENT_SINCE_HAS_RESPONSE_OR_RESPONSE_RECEIVED_ALREADY_ATTACHED, diff --git a/iceoryx_posh/include/iceoryx_posh/internal/popo/base_server.inl b/iceoryx_posh/include/iceoryx_posh/internal/popo/base_server.inl index 9e5eb064598..a777de9378b 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/popo/base_server.inl +++ b/iceoryx_posh/include/iceoryx_posh/internal/popo/base_server.inl @@ -110,10 +110,11 @@ inline void BaseServer::enableState(TriggerHandleT&& trig case ServerState::HAS_REQUEST: if (m_trigger) { - IOX_LOG(WARN) - << "The server is already attached with either the ServerState::HAS_REQUEST or " - "ServerEvent::REQUEST_RECEIVED to a WaitSet/Listener. Detaching it from previous one and " - "attaching it to the new one with ServerState::HAS_REQUEST. Best practice is to call detach first."; + IOX_LOG( + WARN, + "The server is already attached with either the ServerState::HAS_REQUEST or " + "ServerEvent::REQUEST_RECEIVED to a WaitSet/Listener. Detaching it from previous one and " + "attaching it to the new one with ServerState::HAS_REQUEST. Best practice is to call detach first."); errorHandler( PoshError:: @@ -159,11 +160,11 @@ inline void BaseServer::enableEvent(TriggerHandleT&& trig case ServerEvent::REQUEST_RECEIVED: if (m_trigger) { - IOX_LOG(WARN) - << "The server is already attached with either the ServerState::HAS_REQUEST or " - "ServerEvent::REQUEST_RECEIVED to a WaitSet/Listener. Detaching it from previous one and " - "attaching it to the new one with ServerEvent::REQUEST_RECEIVED. Best practice is to call detach " - "first."; + IOX_LOG(WARN, + "The server is already attached with either the ServerState::HAS_REQUEST or " + "ServerEvent::REQUEST_RECEIVED to a WaitSet/Listener. Detaching it from previous one and " + "attaching it to the new one with ServerEvent::REQUEST_RECEIVED. Best practice is to call detach " + "first."); errorHandler( PoshError:: POPO__BASE_SERVER_OVERRIDING_WITH_EVENT_SINCE_HAS_REQUEST_OR_REQUEST_RECEIVED_ALREADY_ATTACHED, diff --git a/iceoryx_posh/include/iceoryx_posh/internal/popo/base_subscriber.inl b/iceoryx_posh/include/iceoryx_posh/internal/popo/base_subscriber.inl index 4209381854d..946c5ce8f37 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/popo/base_subscriber.inl +++ b/iceoryx_posh/include/iceoryx_posh/internal/popo/base_subscriber.inl @@ -118,10 +118,11 @@ inline void BaseSubscriber::enableState(iox::popo::TriggerHandle&& trigg case SubscriberState::HAS_DATA: if (m_trigger) { - IOX_LOG(WARN) - << "The subscriber is already attached with either the SubscriberState::HAS_DATA or " - "SubscriberEvent::DATA_RECEIVED to a WaitSet/Listener. Detaching it from previous one and " - "attaching it to the new one with SubscriberState::HAS_DATA. Best practice is to call detach first."; + IOX_LOG( + WARN, + "The subscriber is already attached with either the SubscriberState::HAS_DATA or " + "SubscriberEvent::DATA_RECEIVED to a WaitSet/Listener. Detaching it from previous one and " + "attaching it to the new one with SubscriberState::HAS_DATA. Best practice is to call detach first."); errorHandler( PoshError::POPO__BASE_SUBSCRIBER_OVERRIDING_WITH_STATE_SINCE_HAS_DATA_OR_DATA_RECEIVED_ALREADY_ATTACHED, @@ -167,11 +168,11 @@ inline void BaseSubscriber::enableEvent(iox::popo::TriggerHandle&& trigg case SubscriberEvent::DATA_RECEIVED: if (m_trigger) { - IOX_LOG(WARN) - << "The subscriber is already attached with either the SubscriberState::HAS_DATA or " - "SubscriberEvent::DATA_RECEIVED to a WaitSet/Listener. Detaching it from previous one and " - "attaching it to the new one with SubscriberEvent::DATA_RECEIVED. Best practice is to call detach " - "first."; + IOX_LOG(WARN, + "The subscriber is already attached with either the SubscriberState::HAS_DATA or " + "SubscriberEvent::DATA_RECEIVED to a WaitSet/Listener. Detaching it from previous one and " + "attaching it to the new one with SubscriberEvent::DATA_RECEIVED. Best practice is to call detach " + "first."); errorHandler( PoshError::POPO__BASE_SUBSCRIBER_OVERRIDING_WITH_EVENT_SINCE_HAS_DATA_OR_DATA_RECEIVED_ALREADY_ATTACHED, ErrorLevel::MODERATE); diff --git a/iceoryx_posh/include/iceoryx_posh/internal/popo/building_blocks/chunk_distributor.inl b/iceoryx_posh/include/iceoryx_posh/internal/popo/building_blocks/chunk_distributor.inl index cebb4d8c5d2..2db654d8dcc 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/popo/building_blocks/chunk_distributor.inl +++ b/iceoryx_posh/include/iceoryx_posh/internal/popo/building_blocks/chunk_distributor.inl @@ -69,8 +69,9 @@ ChunkDistributor::tryAddQueue(not_null getMembers()->m_historyCapacity) { - IOX_LOG(WARN) << "Chunk history request exceeds history capacity! Request is " << requestedHistory - << ". Capacity is " << getMembers()->m_historyCapacity << "."; + IOX_LOG(WARN, + "Chunk history request exceeds history capacity! Request is " + << requestedHistory << ". Capacity is " << getMembers()->m_historyCapacity << "."); } // if the current history is large enough we send the requested number of chunks, else we send the diff --git a/iceoryx_posh/include/iceoryx_posh/internal/popo/building_blocks/chunk_distributor_data.inl b/iceoryx_posh/include/iceoryx_posh/internal/popo/building_blocks/chunk_distributor_data.inl index 3a0ec234c3a..cfff234dc64 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/popo/building_blocks/chunk_distributor_data.inl +++ b/iceoryx_posh/include/iceoryx_posh/internal/popo/building_blocks/chunk_distributor_data.inl @@ -42,7 +42,7 @@ inline ChunkDistributorData ChunkQueuePopper::tryPop auto receivedChunkHeaderVersion = chunk.getChunkHeader()->chunkHeaderVersion(); if (receivedChunkHeaderVersion != mepoo::ChunkHeader::CHUNK_HEADER_VERSION) { - IOX_LOG(ERROR) << "Received chunk with CHUNK_HEADER_VERSION '" << receivedChunkHeaderVersion - << "' but expected '" << mepoo::ChunkHeader::CHUNK_HEADER_VERSION << "'! Dropping chunk!"; + IOX_LOG(ERROR, + "Received chunk with CHUNK_HEADER_VERSION '" << receivedChunkHeaderVersion << "' but expected '" + << mepoo::ChunkHeader::CHUNK_HEADER_VERSION + << "'! Dropping chunk!"); errorHandler(PoshError::POPO__CHUNK_QUEUE_POPPER_CHUNK_WITH_INCOMPATIBLE_CHUNK_HEADER_VERSION, ErrorLevel::SEVERE); return nullopt_t(); diff --git a/iceoryx_posh/include/iceoryx_posh/internal/popo/request.inl b/iceoryx_posh/include/iceoryx_posh/internal/popo/request.inl index edb8a9f41ef..0fe47f12ab0 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/popo/request.inl +++ b/iceoryx_posh/include/iceoryx_posh/internal/popo/request.inl @@ -33,7 +33,7 @@ inline expected Request::send() noexcept } else { - IOX_LOG(ERROR) << "Tried to send empty Request! Might be an already sent or moved Request!"; + IOX_LOG(ERROR, "Tried to send empty Request! Might be an already sent or moved Request!"); errorHandler(PoshError::POSH__SENDING_EMPTY_REQUEST, ErrorLevel::MODERATE); return err(ClientSendError::INVALID_REQUEST); } diff --git a/iceoryx_posh/include/iceoryx_posh/internal/popo/response.inl b/iceoryx_posh/include/iceoryx_posh/internal/popo/response.inl index d9487a17b94..f3d279725d4 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/popo/response.inl +++ b/iceoryx_posh/include/iceoryx_posh/internal/popo/response.inl @@ -33,7 +33,7 @@ inline expected Response::send() noexcept } else { - IOX_LOG(ERROR) << "Tried to send empty Response! Might be an already sent or moved Response!"; + IOX_LOG(ERROR, "Tried to send empty Response! Might be an already sent or moved Response!"); errorHandler(PoshError::POSH__SENDING_EMPTY_RESPONSE, ErrorLevel::MODERATE); return err(ServerSendError::INVALID_RESPONSE); } diff --git a/iceoryx_posh/include/iceoryx_posh/internal/popo/sample.inl b/iceoryx_posh/include/iceoryx_posh/internal/popo/sample.inl index dbc8760a619..8fd28663482 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/popo/sample.inl +++ b/iceoryx_posh/include/iceoryx_posh/internal/popo/sample.inl @@ -33,7 +33,7 @@ void Sample::publish() noexcept } else { - IOX_LOG(ERROR) << "Tried to publish empty Sample! Might be an already published or moved Sample!"; + IOX_LOG(ERROR, "Tried to publish empty Sample! Might be an already published or moved Sample!"); errorHandler(PoshError::POSH__PUBLISHING_EMPTY_SAMPLE, ErrorLevel::MODERATE); } } diff --git a/iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/mempool_introspection.inl b/iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/mempool_introspection.inl index 1b13131dc2a..36c541d76a9 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/mempool_introspection.inl +++ b/iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/mempool_introspection.inl @@ -92,7 +92,7 @@ inline void MemPoolIntrospection:: CHUNK_NO_USER_HEADER_ALIGNMENT); if (maybeChunkHeader.has_error()) { - IOX_LOG(WARN) << "Cannot allocate chunk for mempool introspection!"; + IOX_LOG(WARN, "Cannot allocate chunk for mempool introspection!"); errorHandler(PoshError::MEPOO__CANNOT_ALLOCATE_CHUNK, ErrorLevel::MODERATE); return; } @@ -123,10 +123,10 @@ inline void MemPoolIntrospection:: } else { - IOX_LOG(WARN) - << "Mempool Introspection Container full, Mempool Introspection Data not fully updated! " - << (id + 1U) << " of " << m_segmentManager->m_segmentContainer.size() - << " memory segments sent."; + IOX_LOG(WARN, + "Mempool Introspection Container full, Mempool Introspection Data not fully updated! " + << (id + 1U) << " of " << m_segmentManager->m_segmentContainer.size() + << " memory segments sent."); errorHandler(PoshError::MEPOO__INTROSPECTION_CONTAINER_FULL, ErrorLevel::MODERATE); break; } @@ -135,9 +135,10 @@ inline void MemPoolIntrospection:: } else { - IOX_LOG(WARN) << "Mempool Introspection Container full, Mempool Introspection Data not fully updated! " - << (id + 1U) << " of " << m_segmentManager->m_segmentContainer.size() - << " memory segments sent."; + IOX_LOG(WARN, + "Mempool Introspection Container full, Mempool Introspection Data not fully updated! " + << (id + 1U) << " of " << m_segmentManager->m_segmentContainer.size() + << " memory segments sent."); errorHandler(PoshError::MEPOO__INTROSPECTION_CONTAINER_FULL, ErrorLevel::MODERATE); } diff --git a/iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/process_introspection.inl b/iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/process_introspection.inl index 4b860685b27..fa9f83b6e6f 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/process_introspection.inl +++ b/iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/process_introspection.inl @@ -90,7 +90,7 @@ inline void ProcessIntrospection::addNode(const RuntimeName_t& ru { if (*it_node == nodeName) { - IOX_LOG(WARN) << "Node " << nodeName.c_str() << " already registered"; + IOX_LOG(WARN, "Node " << nodeName.c_str() << " already registered"); alreadyInList = true; } } @@ -102,7 +102,7 @@ inline void ProcessIntrospection::addNode(const RuntimeName_t& ru } if (!processFound) { - IOX_LOG(WARN) << "Trying to register node " << nodeName.c_str() << " but the related process is not registered"; + IOX_LOG(WARN, "Trying to register node " << nodeName.c_str() << " but the related process is not registered"); } m_processListNewData = true; } @@ -131,13 +131,13 @@ inline void ProcessIntrospection::removeNode(const RuntimeName_t& } if (!removedFromList) { - IOX_LOG(WARN) << "Trying to remove node " << nodeName.c_str() << " but it was not registered"; + IOX_LOG(WARN, "Trying to remove node " << nodeName.c_str() << " but it was not registered"); } } } if (!processFound) { - IOX_LOG(WARN) << "Trying to remove node " << nodeName.c_str() << " but the related process is not registered"; + IOX_LOG(WARN, "Trying to remove node " << nodeName.c_str() << " but the related process is not registered"); } m_processListNewData = true; } diff --git a/iceoryx_posh/include/iceoryx_posh/internal/roudi/roudi.hpp b/iceoryx_posh/include/iceoryx_posh/internal/roudi/roudi.hpp index 4b821b9f48d..40788095671 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/roudi/roudi.hpp +++ b/iceoryx_posh/include/iceoryx_posh/internal/roudi/roudi.hpp @@ -153,7 +153,7 @@ class RouDi ScopeGuard m_roudiMemoryManagerCleaner{[this]() { if (this->m_roudiMemoryInterface->destroyMemory().has_error()) { - IOX_LOG(WARN) << "unable to cleanup roudi memory interface"; + IOX_LOG(WARN, "unable to cleanup roudi memory interface"); }; }}; PortManager* m_portManager{nullptr}; diff --git a/iceoryx_posh/include/iceoryx_posh/internal/runtime/ipc_message.inl b/iceoryx_posh/include/iceoryx_posh/internal/runtime/ipc_message.inl index c38f21d2a81..5935ffd6fb1 100644 --- a/iceoryx_posh/include/iceoryx_posh/internal/runtime/ipc_message.inl +++ b/iceoryx_posh/include/iceoryx_posh/internal/runtime/ipc_message.inl @@ -31,7 +31,7 @@ void IpcMessage::addEntry(const T& entry) noexcept if (!isValidEntry(newEntry.str())) { - IOX_LOG(ERROR) << "\'" << newEntry.str().c_str() << "\' is an invalid IPC channel entry"; + IOX_LOG(ERROR, "\'" << newEntry.str().c_str() << "\' is an invalid IPC channel entry"); m_isValid = false; } else diff --git a/iceoryx_posh/include/iceoryx_posh/roudi/memory/iceoryx_roudi_memory_manager.hpp b/iceoryx_posh/include/iceoryx_posh/roudi/memory/iceoryx_roudi_memory_manager.hpp index d5fac9d07c0..c448dc4d8de 100644 --- a/iceoryx_posh/include/iceoryx_posh/roudi/memory/iceoryx_roudi_memory_manager.hpp +++ b/iceoryx_posh/include/iceoryx_posh/roudi/memory/iceoryx_roudi_memory_manager.hpp @@ -69,12 +69,12 @@ class IceOryxRouDiMemoryManager : public RouDiMemoryInterface .or_else([](auto& error) { if (error == posix::FileLockError::LOCKED_BY_OTHER_PROCESS) { - IOX_LOG(FATAL) << "Could not acquire lock, is RouDi still running?"; + IOX_LOG(FATAL, "Could not acquire lock, is RouDi still running?"); errorHandler(PoshError::ICEORYX_ROUDI_MEMORY_MANAGER__ROUDI_STILL_RUNNING, iox::ErrorLevel::FATAL); } else { - IOX_LOG(FATAL) << "Error occurred while acquiring file lock named " << ROUDI_LOCK_NAME; + IOX_LOG(FATAL, "Error occurred while acquiring file lock named " << ROUDI_LOCK_NAME); errorHandler(PoshError::ICEORYX_ROUDI_MEMORY_MANAGER__COULD_NOT_ACQUIRE_FILE_LOCK, iox::ErrorLevel::FATAL); } diff --git a/iceoryx_posh/source/gateway/toml_gateway_config_parser.cpp b/iceoryx_posh/source/gateway/toml_gateway_config_parser.cpp index 0cf6fb8e191..35940a71c89 100644 --- a/iceoryx_posh/source/gateway/toml_gateway_config_parser.cpp +++ b/iceoryx_posh/source/gateway/toml_gateway_config_parser.cpp @@ -33,7 +33,7 @@ iox::config::TomlGatewayConfigParser::parse(const roudi::ConfigFilePathString_t& // Set defaults if no path provided. if (path.size() == 0) { - IOX_LOG(WARN) << "Invalid file path provided. Falling back to built-in config."; + IOX_LOG(WARN, "Invalid file path provided. Falling back to built-in config."); config.setDefaults(); return iox::ok(config); } @@ -42,17 +42,17 @@ iox::config::TomlGatewayConfigParser::parse(const roudi::ConfigFilePathString_t& iox::cxx::FileReader configFile(into(path), "", cxx::FileReader::ErrorMode::Ignore); if (!configFile.isOpen()) { - IOX_LOG(WARN) << "Gateway config file not found at: '" << path << "'. Falling back to built-in config."; + IOX_LOG(WARN, "Gateway config file not found at: '" << path << "'. Falling back to built-in config."); config.setDefaults(); return iox::ok(config); } - IOX_LOG(INFO) << "Using gateway config at: " << path; + IOX_LOG(INFO, "Using gateway config at: " << path); std::ifstream fileStream{path.c_str()}; if (!fileStream.is_open()) { - IOX_LOG(ERROR) << "Could not open config file from path '" << path << "'"; + IOX_LOG(ERROR, "Could not open config file from path '" << path << "'"); return iox::err(iox::config::TomlGatewayConfigParseError::FILE_OPEN_FAILED); } @@ -91,8 +91,9 @@ iox::config::TomlGatewayConfigParser::parse(std::istream& stream, GatewayConfig& { auto parserError = iox::config::TomlGatewayConfigParseError::EXCEPTION_IN_PARSER; auto errorStringIndex = static_cast(parserError); - IOX_LOG(WARN) << iox::config::TOML_GATEWAY_CONFIG_FILE_PARSE_ERROR_STRINGS[errorStringIndex] << ": " - << parserException.what(); + IOX_LOG(WARN, + iox::config::TOML_GATEWAY_CONFIG_FILE_PARSE_ERROR_STRINGS[errorStringIndex] << ": " + << parserException.what()); return iox::err(parserError); } diff --git a/iceoryx_posh/source/mepoo/mem_pool.cpp b/iceoryx_posh/source/mepoo/mem_pool.cpp index 2fdc70c0498..f8a913cd7c4 100644 --- a/iceoryx_posh/source/mepoo/mem_pool.cpp +++ b/iceoryx_posh/source/mepoo/mem_pool.cpp @@ -61,9 +61,10 @@ MemPool::MemPool(const greater_or_equal chunkS } else { - IOX_LOG(FATAL) << "Chunk size must be multiple of '" << CHUNK_MEMORY_ALIGNMENT << "'! Requested size is " - << static_cast(chunkSize) << " for " << static_cast(numberOfChunks) - << " chunks!"; + IOX_LOG(FATAL, + "Chunk size must be multiple of '" << CHUNK_MEMORY_ALIGNMENT << "'! Requested size is " + << static_cast(chunkSize) << " for " + << static_cast(numberOfChunks) << " chunks!"); errorHandler(PoshError::MEPOO__MEMPOOL_CHUNKSIZE_MUST_BE_MULTIPLE_OF_CHUNK_MEMORY_ALIGNMENT); } } @@ -85,8 +86,9 @@ void* MemPool::getChunk() noexcept uint32_t l_index{0U}; if (!m_freeIndices.pop(l_index)) { - IOX_LOG(WARN) << "Mempool [m_chunkSize = " << m_chunkSize << ", numberOfChunks = " << m_numberOfChunks - << ", used_chunks = " << m_usedChunks.load() << " ] has no more space left"; + IOX_LOG(WARN, + "Mempool [m_chunkSize = " << m_chunkSize << ", numberOfChunks = " << m_numberOfChunks + << ", used_chunks = " << m_usedChunks.load() << " ] has no more space left"); return nullptr; } diff --git a/iceoryx_posh/source/mepoo/memory_manager.cpp b/iceoryx_posh/source/mepoo/memory_manager.cpp index d410a3e637d..ceb9558b533 100644 --- a/iceoryx_posh/source/mepoo/memory_manager.cpp +++ b/iceoryx_posh/source/mepoo/memory_manager.cpp @@ -46,20 +46,20 @@ void MemoryManager::addMemPool(BumpAllocator& managementAllocator, uint32_t adjustedChunkSize = sizeWithChunkHeaderStruct(static_cast(chunkPayloadSize)); if (m_denyAddMemPool) { - IOX_LOG(FATAL) - << "After the generation of the chunk management pool you are not allowed to create new mempools."; + IOX_LOG(FATAL, "After the generation of the chunk management pool you are not allowed to create new mempools."); errorHandler(iox::PoshError::MEPOO__MEMPOOL_ADDMEMPOOL_AFTER_GENERATECHUNKMANAGEMENTPOOL); } else if (m_memPoolVector.size() > 0 && adjustedChunkSize <= m_memPoolVector.back().getChunkSize()) { - IOX_LOG(FATAL) << "The following mempools were already added to the mempool handler:" - << [this](auto& log) -> iox::log::LogStream& { - this->printMemPoolVector(log); - return log; - } << "These mempools must be added in an increasing chunk size ordering. The newly added MemPool [ " - "ChunkSize = " - << adjustedChunkSize << ", ChunkPayloadSize = " << static_cast(chunkPayloadSize) - << ", ChunkCount = " << static_cast(numberOfChunks) << "] breaks that requirement!"; + IOX_LOG( + FATAL, + "The following mempools were already added to the mempool handler:" << [this](auto& log) -> auto& { + this->printMemPoolVector(log); + return log; + } << "These mempools must be added in an increasing chunk size ordering. The newly added MemPool [ " + "ChunkSize = " + << adjustedChunkSize << ", ChunkPayloadSize = " << static_cast(chunkPayloadSize) + << ", ChunkCount = " << static_cast(numberOfChunks) << "] breaks that requirement!"); errorHandler(iox::PoshError::MEPOO__MEMPOOL_CONFIG_MUST_BE_ORDERED_BY_INCREASING_SIZE); } @@ -165,30 +165,34 @@ expected MemoryManager::getChunk(const ChunkS if (m_memPoolVector.size() == 0) { - IOX_LOG(FATAL) << "There are no mempools available!"; + IOX_LOG(FATAL, "There are no mempools available!"); errorHandler(iox::PoshError::MEPOO__MEMPOOL_GETCHUNK_CHUNK_WITHOUT_MEMPOOL, ErrorLevel::SEVERE); return err(Error::NO_MEMPOOLS_AVAILABLE); } else if (memPoolPointer == nullptr) { - IOX_LOG(FATAL) << "The following mempools are available:" << [this](auto& log) -> iox::log::LogStream& { - this->printMemPoolVector(log); - return log; - } << "Could not find a fitting mempool for a chunk of size " - << requiredChunkSize; + IOX_LOG( + FATAL, + "The following mempools are available:" << [this](auto& log) -> auto& { + this->printMemPoolVector(log); + return log; + } << "Could not find a fitting mempool for a chunk of size " + << requiredChunkSize); errorHandler(iox::PoshError::MEPOO__MEMPOOL_GETCHUNK_CHUNK_IS_TOO_LARGE, ErrorLevel::SEVERE); return err(Error::NO_MEMPOOL_FOR_REQUESTED_CHUNK_SIZE); } else if (chunk == nullptr) { - IOX_LOG(ERROR) << "MemoryManager: unable to acquire a chunk with a chunk-payload size of " - << chunkSettings.userPayloadSize() - << "The following mempools are available:" << [this](auto& log) -> iox::log::LogStream& { - this->printMemPoolVector(log); - return log; - }; + IOX_LOG( + ERROR, + "MemoryManager: unable to acquire a chunk with a chunk-payload size of " + << chunkSettings.userPayloadSize() + << "The following mempools are available:" << [this](auto& log) -> auto& { + this->printMemPoolVector(log); + return log; + }); errorHandler(iox::PoshError::MEPOO__MEMPOOL_GETCHUNK_POOL_IS_RUNNING_OUT_OF_CHUNKS, ErrorLevel::MODERATE); return err(Error::MEMPOOL_OUT_OF_CHUNKS); diff --git a/iceoryx_posh/source/mepoo/mepoo_config.cpp b/iceoryx_posh/source/mepoo/mepoo_config.cpp index 78db5d04b2f..2f6809e04e7 100644 --- a/iceoryx_posh/source/mepoo/mepoo_config.cpp +++ b/iceoryx_posh/source/mepoo/mepoo_config.cpp @@ -36,7 +36,7 @@ void MePooConfig::addMemPool(MePooConfig::Entry f_entry) noexcept } else { - IOX_LOG(FATAL) << "Maxmimum number of mempools reached, no more mempools available"; + IOX_LOG(FATAL, "Maxmimum number of mempools reached, no more mempools available"); errorHandler(PoshError::MEPOO__MAXIMUM_NUMBER_OF_MEMPOOLS_REACHED, ErrorLevel::FATAL); } } diff --git a/iceoryx_posh/source/popo/building_blocks/condition_notifier.cpp b/iceoryx_posh/source/popo/building_blocks/condition_notifier.cpp index 24fbb694a17..755cf5ecc36 100644 --- a/iceoryx_posh/source/popo/building_blocks/condition_notifier.cpp +++ b/iceoryx_posh/source/popo/building_blocks/condition_notifier.cpp @@ -28,8 +28,9 @@ ConditionNotifier::ConditionNotifier(ConditionVariableData& condVarDataRef, cons { if (index >= MAX_NUMBER_OF_NOTIFIERS) { - IOX_LOG(FATAL) << "The provided index " << index << " is too large. The index has to be in the range of [0, " - << MAX_NUMBER_OF_NOTIFIERS << "[."; + IOX_LOG(FATAL, + "The provided index " << index << " is too large. The index has to be in the range of [0, " + << MAX_NUMBER_OF_NOTIFIERS << "[."); errorHandler(PoshError::POPO__CONDITION_NOTIFIER_INDEX_TOO_LARGE, ErrorLevel::FATAL); } } diff --git a/iceoryx_posh/source/popo/building_blocks/locking_policy.cpp b/iceoryx_posh/source/popo/building_blocks/locking_policy.cpp index 2006061a05a..054ded0f738 100644 --- a/iceoryx_posh/source/popo/building_blocks/locking_policy.cpp +++ b/iceoryx_posh/source/popo/building_blocks/locking_policy.cpp @@ -36,9 +36,9 @@ void ThreadSafePolicy::lock() const noexcept { if (!m_mutex->lock()) { - IOX_LOG(FATAL) - << "Locking of an inter-process mutex failed! This indicates that the application holding the lock " - "was terminated or the resources were cleaned up by RouDi due to an unresponsive application."; + IOX_LOG(FATAL, + "Locking of an inter-process mutex failed! This indicates that the application holding the lock " + "was terminated or the resources were cleaned up by RouDi due to an unresponsive application."); errorHandler(PoshError::POPO__CHUNK_LOCKING_ERROR, ErrorLevel::FATAL); } } @@ -47,9 +47,9 @@ void ThreadSafePolicy::unlock() const noexcept { if (!m_mutex->unlock()) { - IOX_LOG(FATAL) - << "Unlocking of an inter-process mutex failed! This indicates that the resources were cleaned up " - "by RouDi due to an unresponsive application."; + IOX_LOG(FATAL, + "Unlocking of an inter-process mutex failed! This indicates that the resources were cleaned up " + "by RouDi due to an unresponsive application."); errorHandler(PoshError::POPO__CHUNK_UNLOCKING_ERROR, ErrorLevel::FATAL); } } diff --git a/iceoryx_posh/source/popo/ports/client_port_roudi.cpp b/iceoryx_posh/source/popo/ports/client_port_roudi.cpp index ec8f22b4f6e..214e7411ab5 100644 --- a/iceoryx_posh/source/popo/ports/client_port_roudi.cpp +++ b/iceoryx_posh/source/popo/ports/client_port_roudi.cpp @@ -111,8 +111,9 @@ ClientPortRouDi::dispatchCaProMessageAndGetPossibleResponse(const capro::CaproMe void ClientPortRouDi::handleCaProProtocolViolation(const iox::capro::CaproMessageType messageType) noexcept { // this shouldn't be reached - IOX_LOG(FATAL) << "CaPro Protocol Violation! Got '" << messageType << "' in '" - << getMembers()->m_connectionState.load(std::memory_order_relaxed) << "'"; + IOX_LOG(FATAL, + "CaPro Protocol Violation! Got '" + << messageType << "' in '" << getMembers()->m_connectionState.load(std::memory_order_relaxed) << "'"); errorHandler(PoshError::POPO__CAPRO_PROTOCOL_ERROR, ErrorLevel::SEVERE); } diff --git a/iceoryx_posh/source/popo/ports/client_port_user.cpp b/iceoryx_posh/source/popo/ports/client_port_user.cpp index d2cdd9d6b30..c3f3bd2f0b5 100644 --- a/iceoryx_posh/source/popo/ports/client_port_user.cpp +++ b/iceoryx_posh/source/popo/ports/client_port_user.cpp @@ -71,7 +71,7 @@ expected ClientPortUser::sendRequest(RequestHeader* const { if (requestHeader == nullptr) { - IOX_LOG(ERROR) << "Attempted to send a nullptr request!"; + IOX_LOG(ERROR, "Attempted to send a nullptr request!"); errorHandler(PoshError::POPO__CLIENT_PORT_INVALID_REQUEST_TO_SEND_FROM_USER, ErrorLevel::SEVERE); return err(ClientSendError::INVALID_REQUEST); } @@ -80,14 +80,14 @@ expected ClientPortUser::sendRequest(RequestHeader* const if (!connectRequested) { releaseRequest(requestHeader); - IOX_LOG(WARN) << "Try to send request without being connected!"; + IOX_LOG(WARN, "Try to send request without being connected!"); return err(ClientSendError::NO_CONNECT_REQUESTED); } auto numberOfReceiver = m_chunkSender.send(requestHeader->getChunkHeader()); if (numberOfReceiver == 0U) { - IOX_LOG(WARN) << "Try to send request but server is not available!"; + IOX_LOG(WARN, "Try to send request but server is not available!"); return err(ClientSendError::SERVER_NOT_AVAILABLE); } diff --git a/iceoryx_posh/source/popo/ports/server_port_roudi.cpp b/iceoryx_posh/source/popo/ports/server_port_roudi.cpp index f84b85f2c33..a726c1c02ae 100644 --- a/iceoryx_posh/source/popo/ports/server_port_roudi.cpp +++ b/iceoryx_posh/source/popo/ports/server_port_roudi.cpp @@ -91,8 +91,9 @@ ServerPortRouDi::dispatchCaProMessageAndGetPossibleResponse(const capro::CaproMe void ServerPortRouDi::handleCaProProtocolViolation(const capro::CaproMessageType messageType) const noexcept { // this shouldn't be reached - IOX_LOG(FATAL) << "CaPro Protocol Violation! Got '" << messageType << "' with offer state '" - << (getMembers()->m_offered ? "OFFERED" : "NOT OFFERED") << "'!"; + IOX_LOG(FATAL, + "CaPro Protocol Violation! Got '" << messageType << "' with offer state '" + << (getMembers()->m_offered ? "OFFERED" : "NOT OFFERED") << "'!"); errorHandler(PoshError::POPO__CAPRO_PROTOCOL_ERROR, ErrorLevel::SEVERE); } @@ -112,7 +113,7 @@ ServerPortRouDi::handleCaProMessageForStateOffered(const capro::CaproMessage& ca case capro::CaproMessageType::CONNECT: if (caProMessage.m_chunkQueueData == nullptr) { - IOX_LOG(WARN) << "No client response queue passed to server"; + IOX_LOG(WARN, "No client response queue passed to server"); errorHandler(PoshError::POPO__SERVER_PORT_NO_CLIENT_RESPONSE_QUEUE_TO_CONNECT, ErrorLevel::MODERATE); } else diff --git a/iceoryx_posh/source/popo/ports/server_port_user.cpp b/iceoryx_posh/source/popo/ports/server_port_user.cpp index e04b4ef76dc..834109db3ae 100644 --- a/iceoryx_posh/source/popo/ports/server_port_user.cpp +++ b/iceoryx_posh/source/popo/ports/server_port_user.cpp @@ -63,7 +63,7 @@ void ServerPortUser::releaseRequest(const RequestHeader* const requestHeader) no } else { - IOX_LOG(FATAL) << "Provided RequestHeader is a nullptr"; + IOX_LOG(FATAL, "Provided RequestHeader is a nullptr"); errorHandler(PoshError::POPO__SERVER_PORT_INVALID_REQUEST_TO_RELEASE_FROM_USER, ErrorLevel::SEVERE); } } @@ -117,7 +117,7 @@ void ServerPortUser::releaseResponse(const ResponseHeader* const responseHeader) } else { - IOX_LOG(FATAL) << "Provided ResponseHeader is a nullptr"; + IOX_LOG(FATAL, "Provided ResponseHeader is a nullptr"); errorHandler(PoshError::POPO__SERVER_PORT_INVALID_RESPONSE_TO_FREE_FROM_USER, ErrorLevel::SEVERE); } } @@ -126,7 +126,7 @@ expected ServerPortUser::sendResponse(ResponseHeader* con { if (responseHeader == nullptr) { - IOX_LOG(FATAL) << "Provided ResponseHeader is a nullptr"; + IOX_LOG(FATAL, "Provided ResponseHeader is a nullptr"); errorHandler(PoshError::POPO__SERVER_PORT_INVALID_RESPONSE_TO_SEND_FROM_USER, ErrorLevel::SEVERE); return err(ServerSendError::INVALID_RESPONSE); } @@ -135,7 +135,7 @@ expected ServerPortUser::sendResponse(ResponseHeader* con if (!offerRequested) { releaseResponse(responseHeader); - IOX_LOG(WARN) << "Try to send response without having offered!"; + IOX_LOG(WARN, "Try to send response without having offered!"); return err(ServerSendError::NOT_OFFERED); } @@ -150,7 +150,7 @@ expected ServerPortUser::sendResponse(ResponseHeader* con if (!responseSent) { - IOX_LOG(WARN) << "Could not deliver to client! Client not available anymore!"; + IOX_LOG(WARN, "Could not deliver to client! Client not available anymore!"); return err(ServerSendError::CLIENT_NOT_AVAILABLE); } diff --git a/iceoryx_posh/source/roudi/application/roudi_app.cpp b/iceoryx_posh/source/roudi/application/roudi_app.cpp index 9f3d50c1899..a7ed7fff710 100644 --- a/iceoryx_posh/source/roudi/application/roudi_app.cpp +++ b/iceoryx_posh/source/roudi/application/roudi_app.cpp @@ -52,7 +52,7 @@ RouDiApp::RouDiApp(const config::CmdLineArgs_t& cmdLineArgs, const RouDiConfig_t { iox::log::Logger::setLogLevel(m_logLevel); - IOX_LOG(TRACE) << "Command line parameters are:\n" << cmdLineArgs; + IOX_LOG(TRACE, "Command line parameters are:\n" << cmdLineArgs); } } @@ -60,7 +60,7 @@ bool RouDiApp::checkAndOptimizeConfig(const RouDiConfig_t& config) noexcept { if (config.m_sharedMemorySegments.empty()) { - IOX_LOG(ERROR) << "A RouDiConfig without segments was specified! Please provide a valid config!"; + IOX_LOG(ERROR, "A RouDiConfig without segments was specified! Please provide a valid config!"); return false; } @@ -68,8 +68,8 @@ bool RouDiApp::checkAndOptimizeConfig(const RouDiConfig_t& config) noexcept { if (segment.m_mempoolConfig.m_mempoolConfig.empty()) { - IOX_LOG(ERROR) - << "A RouDiConfig with segments without mempools was specified! Please provide a valid config!"; + IOX_LOG(ERROR, + "A RouDiConfig with segments without mempools was specified! Please provide a valid config!"); return false; } } diff --git a/iceoryx_posh/source/roudi/application/roudi_main.cpp b/iceoryx_posh/source/roudi/application/roudi_main.cpp index af5169964cf..e881e074e16 100644 --- a/iceoryx_posh/source/roudi/application/roudi_main.cpp +++ b/iceoryx_posh/source/roudi/application/roudi_main.cpp @@ -30,7 +30,7 @@ int main(int argc, char* argv[]) noexcept auto cmdLineArgs = cmdLineParser.parse(argc, argv); if (cmdLineArgs.has_error() && (cmdLineArgs.error() != iox::config::CmdLineParserResult::INFO_OUTPUT_ONLY)) { - IOX_LOG(FATAL) << "Unable to parse command line arguments!"; + IOX_LOG(FATAL, "Unable to parse command line arguments!"); return EXIT_FAILURE; } @@ -41,8 +41,9 @@ int main(int argc, char* argv[]) noexcept if (roudiConfig.has_error()) { auto errorStringIndex = static_cast(roudiConfig.error()); - IOX_LOG(FATAL) << "Couldn't parse config file. Error: " - << iox::roudi::ROUDI_CONFIG_FILE_PARSE_ERROR_STRINGS[errorStringIndex]; + IOX_LOG(FATAL, + "Couldn't parse config file. Error: " + << iox::roudi::ROUDI_CONFIG_FILE_PARSE_ERROR_STRINGS[errorStringIndex]); return EXIT_FAILURE; } diff --git a/iceoryx_posh/source/roudi/iceoryx_roudi_components.cpp b/iceoryx_posh/source/roudi/iceoryx_roudi_components.cpp index 17e59c34919..0e42e1e7730 100644 --- a/iceoryx_posh/source/roudi/iceoryx_roudi_components.cpp +++ b/iceoryx_posh/source/roudi/iceoryx_roudi_components.cpp @@ -31,7 +31,7 @@ IceOryxRouDiComponents::IceOryxRouDiComponents(const RouDiConfig_t& roudiConfig) runtime::IpcInterfaceBase::cleanupOutdatedIpcChannel(roudi::IPC_CHANNEL_ROUDI_NAME); rouDiMemoryManager.createAndAnnounceMemory().or_else([](RouDiMemoryManagerError error) { - IOX_LOG(FATAL) << "Could not create SharedMemory! Error: " << error; + IOX_LOG(FATAL, "Could not create SharedMemory! Error: " << error); errorHandler(PoshError::ROUDI_COMPONENTS__SHARED_MEMORY_UNAVAILABLE, iox::ErrorLevel::FATAL); }); return &rouDiMemoryManager; diff --git a/iceoryx_posh/source/roudi/memory/memory_provider.cpp b/iceoryx_posh/source/roudi/memory/memory_provider.cpp index 53e56c43b75..2c7123efd67 100644 --- a/iceoryx_posh/source/roudi/memory/memory_provider.cpp +++ b/iceoryx_posh/source/roudi/memory/memory_provider.cpp @@ -91,8 +91,9 @@ expected MemoryProvider::create() noexcept } m_segmentId = maybeSegmentId.value(); - IOX_LOG(DEBUG) << "Registered memory segment " << iox::log::hex(m_memory) << " with size " << m_size << " to id " - << m_segmentId; + IOX_LOG(DEBUG, + "Registered memory segment " << iox::log::hex(m_memory) << " with size " << m_size << " to id " + << m_segmentId); iox::BumpAllocator allocator(m_memory, m_size); diff --git a/iceoryx_posh/source/roudi/memory/posix_shm_memory_provider.cpp b/iceoryx_posh/source/roudi/memory/posix_shm_memory_provider.cpp index 77ca40b4dd9..19b38f10ae9 100644 --- a/iceoryx_posh/source/roudi/memory/posix_shm_memory_provider.cpp +++ b/iceoryx_posh/source/roudi/memory/posix_shm_memory_provider.cpp @@ -42,7 +42,7 @@ PosixShmMemoryProvider::~PosixShmMemoryProvider() noexcept { if (isAvailable()) { - destroy().or_else([](auto) { IOX_LOG(WARN) << "failed to cleanup POSIX shared memory provider resources"; }); + destroy().or_else([](auto) { IOX_LOG(WARN, "failed to cleanup POSIX shared memory provider resources"); }); } } diff --git a/iceoryx_posh/source/roudi/memory/roudi_memory_manager.cpp b/iceoryx_posh/source/roudi/memory/roudi_memory_manager.cpp index 314f01e1535..ae7dbcdc2b2 100644 --- a/iceoryx_posh/source/roudi/memory/roudi_memory_manager.cpp +++ b/iceoryx_posh/source/roudi/memory/roudi_memory_manager.cpp @@ -49,7 +49,7 @@ iox::log::LogStream& operator<<(iox::log::LogStream& logstream, const RouDiMemor RouDiMemoryManager::~RouDiMemoryManager() noexcept { - destroyMemory().or_else([](auto) { IOX_LOG(WARN) << "Failed to cleanup RouDiMemoryManager in destructor."; }); + destroyMemory().or_else([](auto) { IOX_LOG(WARN, "Failed to cleanup RouDiMemoryManager in destructor."); }); } expected RouDiMemoryManager::addMemoryProvider(MemoryProvider* memoryProvider) noexcept @@ -73,8 +73,9 @@ expected RouDiMemoryManager::createAndAnnounceMem auto result = memoryProvider->create(); if (result.has_error()) { - IOX_LOG(ERROR) << "Could not create memory: MemoryProviderError = " - << MemoryProvider::getErrorString(result.error()); + IOX_LOG( + ERROR, + "Could not create memory: MemoryProviderError = " << MemoryProvider::getErrorString(result.error())); return err(RouDiMemoryManagerError::MEMORY_CREATION_FAILED); } } @@ -95,8 +96,8 @@ expected RouDiMemoryManager::destroyMemory() noex auto destructionResult = memoryProvider->destroy(); if (destructionResult.has_error() && destructionResult.error() != MemoryProviderError::MEMORY_NOT_AVAILABLE) { - IOX_LOG(ERROR) << "Could not destroy memory provider! Error: " - << static_cast(destructionResult.error()); + IOX_LOG(ERROR, + "Could not destroy memory provider! Error: " << static_cast(destructionResult.error())); /// @note do not return on first error but try to cleanup the remaining resources if (!result.has_error()) { diff --git a/iceoryx_posh/source/roudi/port_manager.cpp b/iceoryx_posh/source/roudi/port_manager.cpp index ea8b1d3b876..7692771023a 100644 --- a/iceoryx_posh/source/roudi/port_manager.cpp +++ b/iceoryx_posh/source/roudi/port_manager.cpp @@ -35,7 +35,7 @@ capro::Interfaces StringToCaProInterface(const capro::IdString_t& str) noexcept cxx::convert::fromString(str.c_str(), i); if (i >= static_cast(capro::Interfaces::INTERFACE_END)) { - IOX_LOG(WARN) << "invalid enum (out of range: " << i << ")"; + IOX_LOG(WARN, "invalid enum (out of range: " << i << ")"); return capro::Interfaces::INTERNAL; } return static_cast(i); @@ -48,7 +48,7 @@ PortManager::PortManager(RouDiMemoryInterface* roudiMemoryInterface) noexcept auto maybePortPool = m_roudiMemoryInterface->portPool(); if (!maybePortPool.has_value()) { - IOX_LOG(FATAL) << "Could not get PortPool!"; + IOX_LOG(FATAL, "Could not get PortPool!"); errorHandler(PoshError::PORT_MANAGER__PORT_POOL_UNAVAILABLE, iox::ErrorLevel::FATAL); } m_portPool = maybePortPool.value(); @@ -56,7 +56,7 @@ PortManager::PortManager(RouDiMemoryInterface* roudiMemoryInterface) noexcept auto maybeDiscoveryMemoryManager = m_roudiMemoryInterface->discoveryMemoryManager(); if (!maybeDiscoveryMemoryManager.has_value()) { - IOX_LOG(FATAL) << "Could not get MemoryManager for discovery!"; + IOX_LOG(FATAL, "Could not get MemoryManager for discovery!"); errorHandler(PoshError::PORT_MANAGER__DISCOVERY_MEMORY_MANAGER_UNAVAILABLE, iox::ErrorLevel::FATAL); } auto& discoveryMemoryManager = maybeDiscoveryMemoryManager.value(); @@ -79,7 +79,7 @@ PortManager::PortManager(RouDiMemoryInterface* roudiMemoryInterface) noexcept auto maybeIntrospectionMemoryManager = m_roudiMemoryInterface->introspectionMemoryManager(); if (!maybeIntrospectionMemoryManager.has_value()) { - IOX_LOG(FATAL) << "Could not get MemoryManager for introspection!"; + IOX_LOG(FATAL, "Could not get MemoryManager for introspection!"); errorHandler(PoshError::PORT_MANAGER__INTROSPECTION_MEMORY_MANAGER_UNAVAILABLE, iox::ErrorLevel::FATAL); } auto& introspectionMemoryManager = maybeIntrospectionMemoryManager.value(); @@ -158,9 +158,11 @@ void PortManager::doDiscoveryForPublisherPort(PublisherPortRouDiType& publisherP } else { - IOX_LOG(WARN) << "CaPro protocol error for publisher from runtime '" << publisherPort.getRuntimeName() - << "' and with service description '" << publisherPort.getCaProServiceDescription() - << "'! Cannot handle CaProMessageType '" << caproMessage.m_type << "'"; + IOX_LOG(WARN, + "CaPro protocol error for publisher from runtime '" + << publisherPort.getRuntimeName() << "' and with service description '" + << publisherPort.getCaProServiceDescription() << "'! Cannot handle CaProMessageType '" + << caproMessage.m_type << "'"); errorHandler(PoshError::PORT_MANAGER__HANDLE_PUBLISHER_PORTS_INVALID_CAPRO_MESSAGE, iox::ErrorLevel::MODERATE); return; @@ -198,9 +200,10 @@ void PortManager::doDiscoveryForSubscriberPort(SubscriberPortType& subscriberPor m_portIntrospection.reportMessage(caproMessage, subscriberPort.getUniqueID()); if (!this->sendToAllMatchingPublisherPorts(caproMessage, subscriberPort)) { - IOX_LOG(DEBUG) << "capro::SUB/UNSUB, no matching publisher for subscriber from runtime '" - << subscriberPort.getRuntimeName() << "' and with service description '" - << caproMessage.m_serviceDescription << "'!"; + IOX_LOG(DEBUG, + "capro::SUB/UNSUB, no matching publisher for subscriber from runtime '" + << subscriberPort.getRuntimeName() << "' and with service description '" + << caproMessage.m_serviceDescription << "'!"); capro::CaproMessage nackMessage(capro::CaproMessageType::NACK, subscriberPort.getCaProServiceDescription()); auto returnMessage = subscriberPort.dispatchCaProMessageAndGetPossibleResponse(nackMessage); @@ -210,9 +213,11 @@ void PortManager::doDiscoveryForSubscriberPort(SubscriberPortType& subscriberPor } else { - IOX_LOG(WARN) << "CaPro protocol error for subscriber from runtime '" << subscriberPort.getRuntimeName() - << "' and with service description '" << subscriberPort.getCaProServiceDescription() - << "'! Cannot handle CaProMessageType '" << caproMessage.m_type << "'"; + IOX_LOG(WARN, + "CaPro protocol error for subscriber from runtime '" + << subscriberPort.getRuntimeName() << "' and with service description '" + << subscriberPort.getCaProServiceDescription() << "'! Cannot handle CaProMessageType '" + << caproMessage.m_type << "'"); errorHandler(PoshError::PORT_MANAGER__HANDLE_SUBSCRIBER_PORTS_INVALID_CAPRO_MESSAGE, iox::ErrorLevel::MODERATE); return; @@ -242,8 +247,9 @@ void PortManager::destroyClientPort(popo::ClientPortData* const clientPortData) /// @todo iox-#1128 remove from to port introspection - IOX_LOG(DEBUG) << "Destroy client port from runtime '" << clientPortData->m_runtimeName - << "' and with service description '" << clientPortData->m_serviceDescription << "'"; + IOX_LOG(DEBUG, + "Destroy client port from runtime '" << clientPortData->m_runtimeName << "' and with service description '" + << clientPortData->m_serviceDescription << "'"); // delete client port from list after DISCONNECT was processed m_portPool->removeClientPort(clientPortData); @@ -275,9 +281,10 @@ void PortManager::doDiscoveryForClientPort(popo::ClientPortRouDi& clientPort) no /// @todo iox-#1128 report to port introspection if (!this->sendToAllMatchingServerPorts(caproMessage, clientPort)) { - IOX_LOG(DEBUG) << "capro::CONNECT/DISCONNECT, no matching server for client from runtime '" - << clientPort.getRuntimeName() << "' and with service description '" - << caproMessage.m_serviceDescription << "'!"; + IOX_LOG(DEBUG, + "capro::CONNECT/DISCONNECT, no matching server for client from runtime '" + << clientPort.getRuntimeName() << "' and with service description '" + << caproMessage.m_serviceDescription << "'!"); capro::CaproMessage nackMessage(capro::CaproMessageType::NACK, clientPort.getCaProServiceDescription()); auto returnMessage = clientPort.dispatchCaProMessageAndGetPossibleResponse(nackMessage); // No response on NACK messages @@ -286,9 +293,11 @@ void PortManager::doDiscoveryForClientPort(popo::ClientPortRouDi& clientPort) no } else { - IOX_LOG(WARN) << "CaPro protocol error for client from runtime '" << clientPort.getRuntimeName() - << "' and with service description '" << clientPort.getCaProServiceDescription() - << "'! Cannot handle CaProMessageType '" << caproMessage.m_type << "'"; + IOX_LOG(WARN, + "CaPro protocol error for client from runtime '" + << clientPort.getRuntimeName() << "' and with service description '" + << clientPort.getCaProServiceDescription() << "'! Cannot handle CaProMessageType '" + << caproMessage.m_type << "'"); errorHandler(PoshError::PORT_MANAGER__HANDLE_CLIENT_PORTS_INVALID_CAPRO_MESSAGE, iox::ErrorLevel::MODERATE); return; } @@ -331,8 +340,9 @@ void PortManager::destroyServerPort(popo::ServerPortData* const serverPortData) /// @todo iox-#1128 remove from port introspection - IOX_LOG(DEBUG) << "Destroy server port from runtime '" << serverPortData->m_runtimeName - << "' and with service description '" << serverPortData->m_serviceDescription << "'"; + IOX_LOG(DEBUG, + "Destroy server port from runtime '" << serverPortData->m_runtimeName << "' and with service description '" + << serverPortData->m_serviceDescription << "'"); // delete server port from list after STOP_OFFER was processed m_portPool->removeServerPort(serverPortData); @@ -370,9 +380,11 @@ void PortManager::doDiscoveryForServerPort(popo::ServerPortRouDi& serverPort) no } else { - IOX_LOG(WARN) << "CaPro protocol error for server from runtime '" << serverPort.getRuntimeName() - << "' and with service description '" << serverPort.getCaProServiceDescription() - << "'! Cannot handle CaProMessageType '" << caproMessage.m_type << "'"; + IOX_LOG(WARN, + "CaPro protocol error for server from runtime '" + << serverPort.getRuntimeName() << "' and with service description '" + << serverPort.getCaProServiceDescription() << "'! Cannot handle CaProMessageType '" + << caproMessage.m_type << "'"); errorHandler(PoshError::PORT_MANAGER__HANDLE_SERVER_PORTS_INVALID_CAPRO_MESSAGE, iox::ErrorLevel::MODERATE); return; } @@ -399,8 +411,10 @@ void PortManager::handleInterfaces() noexcept // check if we have to destroy this interface port if (interfacePortData->m_toBeDestroyed.load(std::memory_order_relaxed)) { - IOX_LOG(DEBUG) << "Destroy interface port from runtime '" << interfacePortData->m_runtimeName - << "' and with service description '" << interfacePortData->m_serviceDescription << "'"; + IOX_LOG(DEBUG, + "Destroy interface port from runtime '" << interfacePortData->m_runtimeName + << "' and with service description '" + << interfacePortData->m_serviceDescription << "'"); m_portPool->removeInterfacePort(interfacePortData); } } @@ -463,8 +477,9 @@ void PortManager::handleNodes() noexcept { if (nodeData->m_toBeDestroyed.load(std::memory_order_relaxed)) { - IOX_LOG(DEBUG) << "Destroy NodeData from runtime '" << nodeData->m_runtimeName << "' and node name '" - << nodeData->m_nodeName << "'"; + IOX_LOG(DEBUG, + "Destroy NodeData from runtime '" << nodeData->m_runtimeName << "' and node name '" + << nodeData->m_nodeName << "'"); m_portPool->removeNodeData(nodeData); } } @@ -476,8 +491,8 @@ void PortManager::handleConditionVariables() noexcept { if (conditionVariableData->m_toBeDestroyed.load(std::memory_order_relaxed)) { - IOX_LOG(DEBUG) << "Destroy ConditionVariableData from runtime '" << conditionVariableData->m_runtimeName - << "'"; + IOX_LOG(DEBUG, + "Destroy ConditionVariableData from runtime '" << conditionVariableData->m_runtimeName << "'"); m_portPool->removeConditionVariableData(conditionVariableData); } } @@ -778,7 +793,7 @@ void PortManager::deletePortsOfProcess(const RuntimeName_t& runtimeName) noexcep if (runtimeName == interface.getRuntimeName()) { m_portPool->removeInterfacePort(port); - IOX_LOG(DEBUG) << "Deleted Interface of application " << runtimeName; + IOX_LOG(DEBUG, "Deleted Interface of application " << runtimeName); } } @@ -787,7 +802,7 @@ void PortManager::deletePortsOfProcess(const RuntimeName_t& runtimeName) noexcep if (runtimeName == nodeData->m_runtimeName) { m_portPool->removeNodeData(nodeData); - IOX_LOG(DEBUG) << "Deleted node of application " << runtimeName; + IOX_LOG(DEBUG, "Deleted node of application " << runtimeName); } } @@ -796,7 +811,7 @@ void PortManager::deletePortsOfProcess(const RuntimeName_t& runtimeName) noexcep if (runtimeName == conditionVariableData->m_runtimeName) { m_portPool->removeConditionVariableData(conditionVariableData); - IOX_LOG(DEBUG) << "Deleted condition variable of application" << runtimeName; + IOX_LOG(DEBUG, "Deleted condition variable of application" << runtimeName); } } } @@ -823,8 +838,10 @@ void PortManager::destroyPublisherPort(PublisherPortRouDiType::MemberType_t* con m_portIntrospection.removePublisher(publisherPortUser); - IOX_LOG(DEBUG) << "Destroy publisher port from runtime '" << publisherPortData->m_runtimeName - << "' and with service description '" << publisherPortData->m_serviceDescription << "'"; + IOX_LOG(DEBUG, + "Destroy publisher port from runtime '" << publisherPortData->m_runtimeName + << "' and with service description '" + << publisherPortData->m_serviceDescription << "'"); // delete publisher port from list after STOP_OFFER was processed m_portPool->removePublisherPort(publisherPortData); } @@ -849,8 +866,10 @@ void PortManager::destroySubscriberPort(SubscriberPortType::MemberType_t* const m_portIntrospection.removeSubscriber(subscriberPortUser); - IOX_LOG(DEBUG) << "Destroy subscriber port from runtime '" << subscriberPortData->m_runtimeName - << "' and with service description '" << subscriberPortData->m_serviceDescription << "'"; + IOX_LOG(DEBUG, + "Destroy subscriber port from runtime '" << subscriberPortData->m_runtimeName + << "' and with service description '" + << subscriberPortData->m_serviceDescription << "'"); // delete subscriber port from list after UNSUB was processed m_portPool->removeSubscriberPort(subscriberPortData); } @@ -877,13 +896,15 @@ PortManager::acquirePublisherPortDataWithoutDiscovery(const capro::ServiceDescri mepoo::MemoryManager* const payloadDataSegmentMemoryManager, const PortConfigInfo& portConfigInfo) noexcept { - if (doesViolateCommunicationPolicy(service).and_then( - [&](const auto& usedByProcess) { - IOX_LOG(WARN) - << "Process '" << runtimeName + if (doesViolateCommunicationPolicy(service).and_then([&](const auto& + usedByProcess) { + IOX_LOG( + WARN, + "Process '" + << runtimeName << "' violates the communication policy by requesting a PublisherPort which is already used by '" - << usedByProcess << "' with service '" << service.operator cxx::Serialization().toString() << "'."; - })) + << usedByProcess << "' with service '" << service.operator cxx::Serialization().toString() << "'."); + })) { errorHandler(PoshError::POSH__PORT_MANAGER_PUBLISHERPORT_NOT_UNIQUE, ErrorLevel::MODERATE); return err(PortPoolError::UNIQUE_PUBLISHER_PORT_ALREADY_EXISTS); @@ -923,7 +944,7 @@ PortManager::acquireInternalPublisherPortData(const capro::ServiceDescription& s return acquirePublisherPortDataWithoutDiscovery( service, publisherOptions, IPC_CHANNEL_ROUDI_NAME, payloadDataSegmentMemoryManager, PortConfigInfo()) .or_else([&service](auto&) { - IOX_LOG(FATAL) << "Could not create PublisherPort for internal service " << service; + IOX_LOG(FATAL, "Could not create PublisherPort for internal service " << service); errorHandler(PoshError::PORT_MANAGER__NO_PUBLISHER_PORT_FOR_INTERNAL_SERVICE, ErrorLevel::FATAL); }) .and_then([&](auto publisherPortData) { @@ -942,7 +963,7 @@ PublisherPortRouDiType::MemberType_t* PortManager::acquireInternalPublisherPortD return acquirePublisherPortDataWithoutDiscovery( service, publisherOptions, IPC_CHANNEL_ROUDI_NAME, payloadDataSegmentMemoryManager, PortConfigInfo()) .or_else([&service](auto&) { - IOX_LOG(FATAL) << "Could not create PublisherPort for internal service " << service; + IOX_LOG(FATAL, "Could not create PublisherPort for internal service " << service); errorHandler(PoshError::PORT_MANAGER__NO_PUBLISHER_PORT_FOR_INTERNAL_SERVICE, ErrorLevel::FATAL); }) .value(); @@ -1009,10 +1030,12 @@ PortManager::acquireServerPortData(const capro::ServiceDescription& service, destroyServerPort(serverPortData); continue; } - IOX_LOG(WARN) << "Process '" << runtimeName - << "' violates the communication policy by requesting a ServerPort which is already used by '" - << serverPortData->m_runtimeName << "' with service '" - << service.operator cxx::Serialization().toString() << "'."; + IOX_LOG(WARN, + "Process '" + << runtimeName + << "' violates the communication policy by requesting a ServerPort which is already used by '" + << serverPortData->m_runtimeName << "' with service '" + << service.operator cxx::Serialization().toString() << "'."); errorHandler(PoshError::POSH__PORT_MANAGER_SERVERPORT_NOT_UNIQUE, ErrorLevel::MODERATE); return err(PortPoolError::UNIQUE_SERVER_PORT_ALREADY_EXISTS); } @@ -1057,7 +1080,7 @@ void PortManager::publishServiceRegistry() noexcept { // should not happen (except during RouDi shutdown) // the port always exists, otherwise we would terminate during startup - IOX_LOG(WARN) << "Could not publish service registry!"; + IOX_LOG(WARN, "Could not publish service registry!"); return; } PublisherPortUserType publisher(m_serviceRegistryPublisherPortData.value()); @@ -1072,7 +1095,7 @@ void PortManager::publishServiceRegistry() noexcept publisher.sendChunk(chunk); }) - .or_else([](auto&) { IOX_LOG(WARN) << "Could not allocate a chunk for the service registry!"; }); + .or_else([](auto&) { IOX_LOG(WARN, "Could not allocate a chunk for the service registry!"); }); } const ServiceRegistry& PortManager::serviceRegistry() const noexcept @@ -1083,7 +1106,7 @@ const ServiceRegistry& PortManager::serviceRegistry() const noexcept void PortManager::addPublisherToServiceRegistry(const capro::ServiceDescription& service) noexcept { m_serviceRegistry.addPublisher(service).or_else([&](auto&) { - IOX_LOG(WARN) << "Could not add publisher with service description '" << service << "' to service registry!"; + IOX_LOG(WARN, "Could not add publisher with service description '" << service << "' to service registry!"); errorHandler(PoshError::POSH__PORT_MANAGER_COULD_NOT_ADD_SERVICE_TO_REGISTRY, ErrorLevel::MODERATE); }); } @@ -1096,7 +1119,7 @@ void PortManager::removePublisherFromServiceRegistry(const capro::ServiceDescrip void PortManager::addServerToServiceRegistry(const capro::ServiceDescription& service) noexcept { m_serviceRegistry.addServer(service).or_else([&](auto&) { - IOX_LOG(WARN) << "Could not add server with service description '" << service << "' to service registry!"; + IOX_LOG(WARN, "Could not add server with service description '" << service << "' to service registry!"); errorHandler(PoshError::POSH__PORT_MANAGER_COULD_NOT_ADD_SERVICE_TO_REGISTRY, ErrorLevel::MODERATE); }); } diff --git a/iceoryx_posh/source/roudi/port_pool.cpp b/iceoryx_posh/source/roudi/port_pool.cpp index 1c97c846b27..e1b092b2f4c 100644 --- a/iceoryx_posh/source/roudi/port_pool.cpp +++ b/iceoryx_posh/source/roudi/port_pool.cpp @@ -53,7 +53,7 @@ expected PortPool::addInterfacePort(con } else { - IOX_LOG(WARN) << "Out of interface ports! Requested by runtime '" << runtimeName << "'"; + IOX_LOG(WARN, "Out of interface ports! Requested by runtime '" << runtimeName << "'"); errorHandler(PoshError::PORT_POOL__INTERFACELIST_OVERFLOW, ErrorLevel::MODERATE); return err(PortPoolError::INTERFACE_PORT_LIST_FULL); } @@ -70,8 +70,8 @@ expected PortPool::addNodeData(const RuntimeN } else { - IOX_LOG(WARN) << "Out of node data! Requested by runtime '" << runtimeName << "' and node name '" << nodeName - << "'"; + IOX_LOG(WARN, + "Out of node data! Requested by runtime '" << runtimeName << "' and node name '" << nodeName << "'"); errorHandler(PoshError::PORT_POOL__NODELIST_OVERFLOW, ErrorLevel::MODERATE); return err(PortPoolError::NODE_DATA_LIST_FULL); } @@ -87,7 +87,7 @@ PortPool::addConditionVariableData(const RuntimeName_t& runtimeName) noexcept } else { - IOX_LOG(WARN) << "Out of condition variables! Requested by runtime '" << runtimeName << "'"; + IOX_LOG(WARN, "Out of condition variables! Requested by runtime '" << runtimeName << "'"); errorHandler(PoshError::PORT_POOL__CONDITION_VARIABLE_LIST_OVERFLOW, ErrorLevel::MODERATE); return err(PortPoolError::CONDITION_VARIABLE_LIST_FULL); } @@ -133,8 +133,9 @@ PortPool::addPublisherPort(const capro::ServiceDescription& serviceDescription, } else { - IOX_LOG(WARN) << "Out of publisher ports! Requested by runtime '" << runtimeName - << "' and with service description '" << serviceDescription << "'"; + IOX_LOG(WARN, + "Out of publisher ports! Requested by runtime '" << runtimeName << "' and with service description '" + << serviceDescription << "'"); errorHandler(PoshError::PORT_POOL__PUBLISHERLIST_OVERFLOW, ErrorLevel::MODERATE); return err(PortPoolError::PUBLISHER_PORT_LIST_FULL); } @@ -155,8 +156,9 @@ PortPool::addSubscriberPort(const capro::ServiceDescription& serviceDescription, } else { - IOX_LOG(WARN) << "Out of subscriber ports! Requested by runtime '" << runtimeName - << "' and with service description '" << serviceDescription << "'"; + IOX_LOG(WARN, + "Out of subscriber ports! Requested by runtime '" << runtimeName << "' and with service description '" + << serviceDescription << "'"); errorHandler(PoshError::PORT_POOL__SUBSCRIBERLIST_OVERFLOW, ErrorLevel::MODERATE); return err(PortPoolError::SUBSCRIBER_PORT_LIST_FULL); } @@ -181,8 +183,9 @@ PortPool::addClientPort(const capro::ServiceDescription& serviceDescription, { if (!m_portPoolData->m_clientPortMembers.hasFreeSpace()) { - IOX_LOG(WARN) << "Out of client ports! Requested by runtime '" << runtimeName - << "' and with service description '" << serviceDescription << "'"; + IOX_LOG(WARN, + "Out of client ports! Requested by runtime '" << runtimeName << "' and with service description '" + << serviceDescription << "'"); errorHandler(PoshError::PORT_POOL__CLIENTLIST_OVERFLOW, ErrorLevel::MODERATE); return err(PortPoolError::CLIENT_PORT_LIST_FULL); } @@ -201,8 +204,9 @@ PortPool::addServerPort(const capro::ServiceDescription& serviceDescription, { if (!m_portPoolData->m_serverPortMembers.hasFreeSpace()) { - IOX_LOG(WARN) << "Out of server ports! Requested by runtime '" << runtimeName - << "' and with service description '" << serviceDescription << "'"; + IOX_LOG(WARN, + "Out of server ports! Requested by runtime '" << runtimeName << "' and with service description '" + << serviceDescription << "'"); errorHandler(PoshError::PORT_POOL__SERVERLIST_OVERFLOW, ErrorLevel::MODERATE); return err(PortPoolError::SERVER_PORT_LIST_FULL); } diff --git a/iceoryx_posh/source/roudi/process.cpp b/iceoryx_posh/source/roudi/process.cpp index b857df61928..c3b05bc7785 100644 --- a/iceoryx_posh/source/roudi/process.cpp +++ b/iceoryx_posh/source/roudi/process.cpp @@ -54,7 +54,7 @@ void Process::sendViaIpcChannel(const runtime::IpcMessage& data) noexcept bool sendSuccess = m_ipcChannel.send(data); if (!sendSuccess) { - IOX_LOG(WARN) << "Process cannot send message over communication channel"; + IOX_LOG(WARN, "Process cannot send message over communication channel"); errorHandler(PoshError::POSH__ROUDI_PROCESS_SEND_VIA_IPC_CHANNEL_FAILED, ErrorLevel::MODERATE); } } diff --git a/iceoryx_posh/source/roudi/process_manager.cpp b/iceoryx_posh/source/roudi/process_manager.cpp index b18c5da00fe..8c67ef673a1 100644 --- a/iceoryx_posh/source/roudi/process_manager.cpp +++ b/iceoryx_posh/source/roudi/process_manager.cpp @@ -48,7 +48,7 @@ ProcessManager::ProcessManager(RouDiMemoryInterface& roudiMemoryInterface, auto maybeSegmentManager = m_roudiMemoryInterface.segmentManager(); if (!maybeSegmentManager.has_value()) { - IOX_LOG(FATAL) << "Invalid state! Could not obtain SegmentManager!"; + IOX_LOG(FATAL, "Invalid state! Could not obtain SegmentManager!"); fatalError = true; } m_segmentManager = maybeSegmentManager.value(); @@ -56,7 +56,7 @@ ProcessManager::ProcessManager(RouDiMemoryInterface& roudiMemoryInterface, auto maybeIntrospectionMemoryManager = m_roudiMemoryInterface.introspectionMemoryManager(); if (!maybeIntrospectionMemoryManager.has_value()) { - IOX_LOG(FATAL) << "Invalid state! Could not obtain MemoryManager for instrospection!"; + IOX_LOG(FATAL, "Invalid state! Could not obtain MemoryManager for instrospection!"); fatalError = true; } m_introspectionMemoryManager = maybeIntrospectionMemoryManager.value(); @@ -64,7 +64,7 @@ ProcessManager::ProcessManager(RouDiMemoryInterface& roudiMemoryInterface, auto maybeMgmtSegmentId = m_roudiMemoryInterface.mgmtMemoryProvider()->segmentId(); if (!maybeMgmtSegmentId.has_value()) { - IOX_LOG(FATAL) << "Invalid state! Could not obtain SegmentId for iceoryx management segment!"; + IOX_LOG(FATAL, "Invalid state! Could not obtain SegmentId for iceoryx management segment!"); fatalError = true; } m_mgmtSegmentId = maybeMgmtSegmentId.value(); @@ -86,7 +86,7 @@ void ProcessManager::handleProcessShutdownPreparationRequest(const RuntimeName_t sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::PREPARE_APP_TERMINATION_ACK); process->sendViaIpcChannel(sendBuffer); }) - .or_else([&]() { IOX_LOG(WARN) << "Unknown application " << name << " requested shutdown preparation."; }); + .or_else([&]() { IOX_LOG(WARN, "Unknown application " << name << " requested shutdown preparation."); }); } void ProcessManager::requestShutdownOfAllProcesses() noexcept @@ -94,7 +94,7 @@ void ProcessManager::requestShutdownOfAllProcesses() noexcept // send SIG_TERM to all running applications and wait for processes to answer with TERMINATION for (auto& process : m_processList) { - IOX_LOG(DEBUG) << "Sending SIGTERM to Process ID " << process.getPid() << " named '" << process.getName(); + IOX_LOG(DEBUG, "Sending SIGTERM to Process ID " << process.getPid() << " named '" << process.getName()); requestShutdownOfProcess(process, ShutdownPolicy::SIG_TERM); } @@ -123,8 +123,9 @@ void ProcessManager::killAllProcesses() noexcept { for (auto& process : m_processList) { - IOX_LOG(WARN) << "Process ID " << process.getPid() << " named '" << process.getName() - << "' is still running after SIGTERM was sent. RouDi is sending SIGKILL now."; + IOX_LOG(WARN, + "Process ID " << process.getPid() << " named '" << process.getName() + << "' is still running after SIGTERM was sent. RouDi is sending SIGKILL now."); requestShutdownOfProcess(process, ShutdownPolicy::SIG_KILL); } } @@ -133,8 +134,9 @@ void ProcessManager::printWarningForRegisteredProcessesAndClearProcessList() noe { for (auto& process : m_processList) { - IOX_LOG(WARN) << "Process ID " << process.getPid() << " named '" << process.getName() - << "' is still running after SIGKILL was sent. RouDi is ignoring this process."; + IOX_LOG(WARN, + "Process ID " << process.getPid() << " named '" << process.getName() + << "' is still running after SIGKILL was sent. RouDi is ignoring this process."); } m_processList.clear(); } @@ -175,19 +177,19 @@ void ProcessManager::evaluateKillError(const Process& process, { if ((errnum == EINVAL) || (errnum == EPERM) || (errnum == ESRCH)) { - IOX_LOG(WARN) << "Process ID " << process.getPid() << " named '" << process.getName() - << "' could not be killed with " - << (shutdownPolicy == ShutdownPolicy::SIG_KILL ? "SIGKILL" : "SIGTERM") - << ", because the command failed with the following error: " << errorString - << " See manpage for kill(2) or type 'man 2 kill' in console for more information"; + IOX_LOG(WARN, + "Process ID " << process.getPid() << " named '" << process.getName() << "' could not be killed with " + << (shutdownPolicy == ShutdownPolicy::SIG_KILL ? "SIGKILL" : "SIGTERM") + << ", because the command failed with the following error: " << errorString + << " See manpage for kill(2) or type 'man 2 kill' in console for more information"); errorHandler(PoshError::POSH__ROUDI_PROCESS_SHUTDOWN_FAILED, ErrorLevel::SEVERE); } else { - IOX_LOG(WARN) << "Process ID " << process.getPid() << " named '" << process.getName() - << "' could not be killed with" - << (shutdownPolicy == ShutdownPolicy::SIG_KILL ? "SIGKILL" : "SIGTERM") - << " for unknown reason: '" << errorString << "'"; + IOX_LOG(WARN, + "Process ID " << process.getPid() << " named '" << process.getName() << "' could not be killed with" + << (shutdownPolicy == ShutdownPolicy::SIG_KILL ? "SIGKILL" : "SIGTERM") + << " for unknown reason: '" << errorString << "'"); errorHandler(PoshError::POSH__ROUDI_PROCESS_SHUTDOWN_FAILED, ErrorLevel::SEVERE); } } @@ -211,17 +213,17 @@ bool ProcessManager::registerProcess(const RuntimeName_t& name, if (process->isMonitored()) { - IOX_LOG(WARN) << "Received register request, but termination of " << name << " not detected yet"; + IOX_LOG(WARN, "Received register request, but termination of " << name << " not detected yet"); } // process exists, we expect that the existing process crashed - IOX_LOG(WARN) << "Application " << name << " crashed. Re-registering application"; + IOX_LOG(WARN, "Application " << name << " crashed. Re-registering application"); // remove the existing process and add the new process afterwards, we do not send ack to new process constexpr TerminationFeedback TERMINATION_FEEDBACK{TerminationFeedback::DO_NOT_SEND_ACK_TO_PROCESS}; if (!this->searchForProcessAndRemoveIt(name, TERMINATION_FEEDBACK)) { - IOX_LOG(WARN) << "Application " << name << " could not be removed"; + IOX_LOG(WARN, "Application " << name << " could not be removed"); return; } else @@ -249,17 +251,19 @@ bool ProcessManager::addProcess(const RuntimeName_t& name, { if (!version::VersionInfo::getCurrentVersion().checkCompatibility(versionInfo, m_compatibilityCheckLevel)) { - IOX_LOG(ERROR) - << "Version mismatch from '" << name - << "'! Please build your app and RouDi against the same iceoryx version (version & commitID). RouDi: " - << version::VersionInfo::getCurrentVersion().operator iox::cxx::Serialization().toString() - << " App: " << versionInfo.operator iox::cxx::Serialization().toString(); + IOX_LOG( + ERROR, + "Version mismatch from '" + << name + << "'! Please build your app and RouDi against the same iceoryx version (version & commitID). RouDi: " + << version::VersionInfo::getCurrentVersion().operator iox::cxx::Serialization().toString() + << " App: " << versionInfo.operator iox::cxx::Serialization().toString()); return false; } // overflow check if (m_processList.size() >= MAX_PROCESS_NUMBER) { - IOX_LOG(ERROR) << "Could not register process '" << name << "' - too many processes"; + IOX_LOG(ERROR, "Could not register process '" << name << "' - too many processes"); return false; } m_processList.emplace_back(name, pid, user, isMonitored, sessionId); @@ -280,7 +284,7 @@ bool ProcessManager::addProcess(const RuntimeName_t& name, m_processIntrospection->addProcess(static_cast(pid), name); - IOX_LOG(DEBUG) << "Registered new application " << name; + IOX_LOG(DEBUG, "Registered new application " << name); return true; } @@ -289,7 +293,7 @@ bool ProcessManager::unregisterProcess(const RuntimeName_t& name) noexcept constexpr TerminationFeedback FEEDBACK{TerminationFeedback::SEND_ACK_TO_PROCESS}; if (!searchForProcessAndRemoveIt(name, FEEDBACK)) { - IOX_LOG(ERROR) << "Application " << name << " could not be unregistered!"; + IOX_LOG(ERROR, "Application " << name << " could not be unregistered!"); return false; } return true; @@ -306,7 +310,7 @@ bool ProcessManager::searchForProcessAndRemoveIt(const RuntimeName_t& name, cons { if (removeProcessAndDeleteRespectiveSharedMemoryObjects(it, feedback)) { - IOX_LOG(DEBUG) << "Removed existing application " << name; + IOX_LOG(DEBUG, "Removed existing application " << name); } return true; // we can assume there are no other processes with this name } @@ -344,7 +348,7 @@ void ProcessManager::updateLivelinessOfProcess(const RuntimeName_t& name) noexce // reset timestamp process->setTimestamp(mepoo::BaseClock_t::now()); }) - .or_else([&]() { IOX_LOG(WARN) << "Received Keepalive from unknown process " << name; }); + .or_else([&]() { IOX_LOG(WARN, "Received Keepalive from unknown process " << name); }); } void ProcessManager::addInterfaceForProcess(const RuntimeName_t& name, @@ -364,9 +368,9 @@ void ProcessManager::addInterfaceForProcess(const RuntimeName_t& name, << cxx::convert::toString(offset) << cxx::convert::toString(m_mgmtSegmentId); process->sendViaIpcChannel(sendBuffer); - IOX_LOG(DEBUG) << "Created new interface for application " << name; + IOX_LOG(DEBUG, "Created new interface for application " << name); }) - .or_else([&]() { IOX_LOG(WARN) << "Unknown application " << name << " requested an interface."; }); + .or_else([&]() { IOX_LOG(WARN, "Unknown application " << name << " requested an interface."); }); } void ProcessManager::addNodeForProcess(const RuntimeName_t& runtimeName, const NodeName_t& nodeName) noexcept @@ -384,7 +388,7 @@ void ProcessManager::addNodeForProcess(const RuntimeName_t& runtimeName, const N process->sendViaIpcChannel(sendBuffer); m_processIntrospection->addNode(RuntimeName_t(TruncateToCapacity, runtimeName.c_str()), NodeName_t(TruncateToCapacity, nodeName.c_str())); - IOX_LOG(DEBUG) << "Created new node " << nodeName << " for process " << runtimeName; + IOX_LOG(DEBUG, "Created new node " << nodeName << " for process " << runtimeName); }) .or_else([&](PortPoolError error) { runtime::IpcMessage sendBuffer; @@ -396,10 +400,10 @@ void ProcessManager::addNodeForProcess(const RuntimeName_t& runtimeName, const N } process->sendViaIpcChannel(sendBuffer); - IOX_LOG(DEBUG) << "Could not create new node for process " << runtimeName; + IOX_LOG(DEBUG, "Could not create new node for process " << runtimeName); }); }) - .or_else([&]() { IOX_LOG(WARN) << "Unknown process " << runtimeName << " requested a node."; }); + .or_else([&]() { IOX_LOG(WARN, "Unknown process " << runtimeName << " requested a node."); }); } void ProcessManager::sendMessageNotSupportedToRuntime(const RuntimeName_t& name) noexcept @@ -409,7 +413,7 @@ void ProcessManager::sendMessageNotSupportedToRuntime(const RuntimeName_t& name) sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::MESSAGE_NOT_SUPPORTED); process->sendViaIpcChannel(sendBuffer); - IOX_LOG(ERROR) << "Application " << name << " sent a message, which is not supported by this RouDi"; + IOX_LOG(ERROR, "Application " << name << " sent a message, which is not supported by this RouDi"); }); } @@ -434,8 +438,9 @@ void ProcessManager::addSubscriberForProcess(const RuntimeName_t& name, << cxx::convert::toString(offset) << cxx::convert::toString(m_mgmtSegmentId); process->sendViaIpcChannel(sendBuffer); - IOX_LOG(DEBUG) << "Created new SubscriberPort for application '" << name - << "' with service description '" << service << "'"; + IOX_LOG(DEBUG, + "Created new SubscriberPort for application '" << name << "' with service description '" + << service << "'"); } else { @@ -443,13 +448,15 @@ void ProcessManager::addSubscriberForProcess(const RuntimeName_t& name, sendBuffer << runtime::IpcMessageTypeToString(runtime::IpcMessageType::ERROR); sendBuffer << runtime::IpcMessageErrorTypeToString(runtime::IpcMessageErrorType::SUBSCRIBER_LIST_FULL); process->sendViaIpcChannel(sendBuffer); - IOX_LOG(ERROR) << "Could not create SubscriberPort for application '" << name - << "' with service description '" << service << "'"; + IOX_LOG(ERROR, + "Could not create SubscriberPort for application '" << name << "' with service description '" + << service << "'"); } }) .or_else([&]() { - IOX_LOG(WARN) << "Unknown application '" << name - << "' requested a SubscriberPort with service description '" << service << "'"; + IOX_LOG(WARN, + "Unknown application '" << name << "' requested a SubscriberPort with service description '" + << service << "'"); }); } @@ -486,8 +493,9 @@ void ProcessManager::addPublisherForProcess(const RuntimeName_t& name, << cxx::convert::toString(offset) << cxx::convert::toString(m_mgmtSegmentId); process->sendViaIpcChannel(sendBuffer); - IOX_LOG(DEBUG) << "Created new PublisherPort for application '" << name - << "' with service description '" << service << "'"; + IOX_LOG(DEBUG, + "Created new PublisherPort for application '" << name << "' with service description '" + << service << "'"); } else { @@ -517,13 +525,15 @@ void ProcessManager::addPublisherForProcess(const RuntimeName_t& name, sendBuffer << error; process->sendViaIpcChannel(sendBuffer); - IOX_LOG(ERROR) << "Could not create PublisherPort for application '" << name - << "' with service description '" << service << "'"; + IOX_LOG(ERROR, + "Could not create PublisherPort for application '" << name << "' with service description '" + << service << "'"); } }) .or_else([&]() { - IOX_LOG(WARN) << "Unknown application '" << name << "' requested a PublisherPort with service description '" - << service << "'"; + IOX_LOG(WARN, + "Unknown application '" << name << "' requested a PublisherPort with service description '" + << service << "'"); }); } @@ -560,8 +570,9 @@ void ProcessManager::addClientForProcess(const RuntimeName_t& name, << cxx::convert::toString(m_mgmtSegmentId); process->sendViaIpcChannel(sendBuffer); - IOX_LOG(DEBUG) << "Created new ClientPort for application '" << name - << "' with service description '" << service << "'"; + IOX_LOG(DEBUG, + "Created new ClientPort for application '" << name << "' with service description '" + << service << "'"); }) .or_else([&](auto&) { runtime::IpcMessage sendBuffer; @@ -569,13 +580,15 @@ void ProcessManager::addClientForProcess(const RuntimeName_t& name, sendBuffer << runtime::IpcMessageErrorTypeToString(runtime::IpcMessageErrorType::CLIENT_LIST_FULL); process->sendViaIpcChannel(sendBuffer); - IOX_LOG(ERROR) << "Could not create ClientPort for application '" << name - << "' with service description '" << service << "'"; + IOX_LOG(ERROR, + "Could not create ClientPort for application '" << name << "' with service description '" + << service << "'"); }); }) .or_else([&]() { - IOX_LOG(WARN) << "Unknown application '" << name << "' requested a ClientPort with service description '" - << service << "'"; + IOX_LOG(WARN, + "Unknown application '" << name << "' requested a ClientPort with service description '" << service + << "'"); }); } @@ -612,8 +625,9 @@ void ProcessManager::addServerForProcess(const RuntimeName_t& name, << cxx::convert::toString(m_mgmtSegmentId); process->sendViaIpcChannel(sendBuffer); - IOX_LOG(DEBUG) << "Created new ServerPort for application '" << name - << "' with service description '" << service << "'"; + IOX_LOG(DEBUG, + "Created new ServerPort for application '" << name << "' with service description '" + << service << "'"); }) .or_else([&](auto&) { runtime::IpcMessage sendBuffer; @@ -621,13 +635,15 @@ void ProcessManager::addServerForProcess(const RuntimeName_t& name, sendBuffer << runtime::IpcMessageErrorTypeToString(runtime::IpcMessageErrorType::SERVER_LIST_FULL); process->sendViaIpcChannel(sendBuffer); - IOX_LOG(ERROR) << "Could not create ServerPort for application '" << name - << "' with service description '" << service << "'"; + IOX_LOG(ERROR, + "Could not create ServerPort for application '" << name << "' with service description '" + << service << "'"); }); }) .or_else([&]() { - IOX_LOG(WARN) << "Unknown application '" << name << "' requested a ServerPort with service description '" - << service << "'"; + IOX_LOG(WARN, + "Unknown application '" << name << "' requested a ServerPort with service description '" << service + << "'"); }); } @@ -645,7 +661,7 @@ void ProcessManager::addConditionVariableForProcess(const RuntimeName_t& runtime << cxx::convert::toString(offset) << cxx::convert::toString(m_mgmtSegmentId); process->sendViaIpcChannel(sendBuffer); - IOX_LOG(DEBUG) << "Created new ConditionVariable for application " << runtimeName; + IOX_LOG(DEBUG, "Created new ConditionVariable for application " << runtimeName); }) .or_else([&](PortPoolError error) { runtime::IpcMessage sendBuffer; @@ -657,11 +673,10 @@ void ProcessManager::addConditionVariableForProcess(const RuntimeName_t& runtime } process->sendViaIpcChannel(sendBuffer); - IOX_LOG(DEBUG) << "Could not create new ConditionVariable for application " << runtimeName; + IOX_LOG(DEBUG, "Could not create new ConditionVariable for application " << runtimeName); }); }) - .or_else( - [&]() { IOX_LOG(WARN) << "Unknown application " << runtimeName << " requested a ConditionVariable."; }); + .or_else([&]() { IOX_LOG(WARN, "Unknown application " << runtimeName << " requested a ConditionVariable."); }); } void ProcessManager::initIntrospection(ProcessIntrospectionType* processIntrospection) noexcept @@ -712,8 +727,9 @@ void ProcessManager::monitorProcesses() noexcept "keep alive timeout too small"); if (timediff > runtime::PROCESS_KEEP_ALIVE_TIMEOUT) { - IOX_LOG(WARN) << "Application " << processIterator->getName() << " not responding (last response " - << timediff.toMilliseconds() << " milliseconds ago) --> removing it"; + IOX_LOG(WARN, + "Application " << processIterator->getName() << " not responding (last response " + << timediff.toMilliseconds() << " milliseconds ago) --> removing it"); // note: if we would want to use the removeProcess function, it would search for the process again // (but we already found it and have an iterator to remove it) diff --git a/iceoryx_posh/source/roudi/roudi.cpp b/iceoryx_posh/source/roudi/roudi.cpp index 3b82b5b07b7..2a8ec6fabd5 100644 --- a/iceoryx_posh/source/roudi/roudi.cpp +++ b/iceoryx_posh/source/roudi/roudi.cpp @@ -55,7 +55,7 @@ RouDi::RouDi(RouDiMemoryInterface& roudiMemoryInterface, { if (internal::isCompiledOn32BitSystem()) { - IOX_LOG(WARN) << "Runnning RouDi on 32-bit architectures is not supported! Use at your own risk!"; + IOX_LOG(WARN, "Runnning RouDi on 32-bit architectures is not supported! Use at your own risk!"); } m_processIntrospection.registerPublisherPort( PublisherPortUserType(m_prcMgr->addIntrospectionPublisherPort(IntrospectionProcessService))); @@ -109,9 +109,9 @@ void RouDi::shutdown() noexcept // wait for the monitoring and discovery thread to stop if (m_monitoringAndDiscoveryThread.joinable()) { - IOX_LOG(DEBUG) << "Joining 'Mon+Discover' thread..."; + IOX_LOG(DEBUG, "Joining 'Mon+Discover' thread..."); m_monitoringAndDiscoveryThread.join(); - IOX_LOG(DEBUG) << "...'Mon+Discover' thread joined."; + IOX_LOG(DEBUG, "...'Mon+Discover' thread joined."); } if (m_killProcessesInDestructor) @@ -123,8 +123,9 @@ void RouDi::shutdown() noexcept { if (remainingDurationForInfoPrint > terminationDelayTimer.remainingTime()) { - IOX_LOG(WARN) << "Some applications seem to be still running! Time until graceful shutdown: " - << terminationDelayTimer.remainingTime().toSeconds() << "s!"; + IOX_LOG(WARN, + "Some applications seem to be still running! Time until graceful shutdown: " + << terminationDelayTimer.remainingTime().toSeconds() << "s!"); remainingDurationForInfoPrint = remainingDurationForInfoPrint - 5_s; } std::this_thread::sleep_for(std::chrono::milliseconds(PROCESS_TERMINATED_CHECK_INTERVAL.toMilliseconds())); @@ -138,8 +139,9 @@ void RouDi::shutdown() noexcept { if (remainingDurationForWarnPrint > finalKillTimer.remainingTime()) { - IOX_LOG(WARN) << "Some applications seem to not shutdown gracefully! Time until hard shutdown: " - << finalKillTimer.remainingTime().toSeconds() << "s!"; + IOX_LOG(WARN, + "Some applications seem to not shutdown gracefully! Time until hard shutdown: " + << finalKillTimer.remainingTime().toSeconds() << "s!"); remainingDurationForWarnPrint = remainingDurationForWarnPrint - 5_s; } // give processes some time to terminate @@ -164,9 +166,9 @@ void RouDi::shutdown() noexcept if (m_handleRuntimeMessageThread.joinable()) { - IOX_LOG(DEBUG) << "Joining 'IPC-msg-process' thread..."; + IOX_LOG(DEBUG, "Joining 'IPC-msg-process' thread..."); m_handleRuntimeMessageThread.join(); - IOX_LOG(DEBUG) << "...'IPC-msg-process' thread joined."; + IOX_LOG(DEBUG, "...'IPC-msg-process' thread joined."); } } @@ -184,16 +186,18 @@ void RouDi::triggerDiscoveryLoopAndWaitToFinish(units::Duration timeout) noexcep .and_then([&decrementSemaphoreCount](const auto& countNonZero) { decrementSemaphoreCount = countNonZero; }) .or_else([&decrementSemaphoreCount](const auto& error) { decrementSemaphoreCount = false; - IOX_LOG(ERROR) << "Could not decrement count of the semaphore which signals a finished run of the " - "discovery loop! Error: " - << static_cast(error); + IOX_LOG(ERROR, + "Could not decrement count of the semaphore which signals a finished run of the " + "discovery loop! Error: " + << static_cast(error)); }); } m_discoveryLoopTrigger.trigger(); m_discoveryFinishedSemaphore->timedWait(timeout).or_else([](const auto& error) { - IOX_LOG(ERROR) << "A timed wait on the semaphore which signals a finished run of the " - "discovery loop failed! Error: " - << static_cast(error); + IOX_LOG(ERROR, + "A timed wait on the semaphore which signals a finished run of the " + "discovery loop failed! Error: " + << static_cast(error)); }); } @@ -222,8 +226,9 @@ void RouDi::monitorAndDiscoveryUpdate() noexcept if (manuallyTriggered) { m_discoveryFinishedSemaphore->post().or_else([](const auto& error) { - IOX_LOG(ERROR) << "Could not trigger semaphore to signal a finished run of the discovery loop! Error: " - << static_cast(error); + IOX_LOG(ERROR, + "Could not trigger semaphore to signal a finished run of the discovery loop! Error: " + << static_cast(error)); }); } @@ -243,7 +248,7 @@ void RouDi::processRuntimeMessages() noexcept { runtime::IpcInterfaceCreator roudiIpcInterface{IPC_CHANNEL_ROUDI_NAME}; - IOX_LOG(INFO) << "RouDi is ready for clients"; + IOX_LOG(INFO, "RouDi is ready for clients"); fflush(stdout); // explicitly flush 'stdout' for 'launch_testing' while (m_runHandleRuntimeMessageThread) @@ -282,8 +287,8 @@ void RouDi::processMessage(const runtime::IpcMessage& message, { if (message.getNumberOfElements() != 6) { - IOX_LOG(ERROR) << "Wrong number of parameters for \"IpcMessageType::REG\" from \"" << runtimeName - << "\"received!"; + IOX_LOG(ERROR, + "Wrong number of parameters for \"IpcMessageType::REG\" from \"" << runtimeName << "\"received!"); } else { @@ -305,8 +310,9 @@ void RouDi::processMessage(const runtime::IpcMessage& message, { if (message.getNumberOfElements() != 5) { - IOX_LOG(ERROR) << "Wrong number of parameters for \"IpcMessageType::CREATE_PUBLISHER\" from \"" - << runtimeName << "\"received!"; + IOX_LOG(ERROR, + "Wrong number of parameters for \"IpcMessageType::CREATE_PUBLISHER\" from \"" << runtimeName + << "\"received!"); } else { @@ -314,8 +320,8 @@ void RouDi::processMessage(const runtime::IpcMessage& message, capro::ServiceDescription::deserialize(cxx::Serialization(message.getElementAtIndex(2))); if (deserializationResult.has_error()) { - IOX_LOG(ERROR) << "Deserialization failed when '" << message.getElementAtIndex(2).c_str() - << "' was provided\n"; + IOX_LOG(ERROR, + "Deserialization failed when '" << message.getElementAtIndex(2).c_str() << "' was provided\n"); break; } const auto& service = deserializationResult.value(); @@ -324,8 +330,9 @@ void RouDi::processMessage(const runtime::IpcMessage& message, popo::PublisherOptions::deserialize(cxx::Serialization(message.getElementAtIndex(3))); if (publisherOptionsDeserializationResult.has_error()) { - IOX_LOG(ERROR) << "Deserialization of 'PublisherOptions' failed when '" - << message.getElementAtIndex(3).c_str() << "' was provided\n"; + IOX_LOG(ERROR, + "Deserialization of 'PublisherOptions' failed when '" << message.getElementAtIndex(3).c_str() + << "' was provided\n"); break; } const auto& publisherOptions = publisherOptionsDeserializationResult.value(); @@ -341,8 +348,9 @@ void RouDi::processMessage(const runtime::IpcMessage& message, { if (message.getNumberOfElements() != 5) { - IOX_LOG(ERROR) << "Wrong number of parameters for \"IpcMessageType::CREATE_SUBSCRIBER\" from \"" - << runtimeName << "\"received!"; + IOX_LOG(ERROR, + "Wrong number of parameters for \"IpcMessageType::CREATE_SUBSCRIBER\" from \"" << runtimeName + << "\"received!"); } else { @@ -350,8 +358,8 @@ void RouDi::processMessage(const runtime::IpcMessage& message, capro::ServiceDescription::deserialize(cxx::Serialization(message.getElementAtIndex(2))); if (deserializationResult.has_error()) { - IOX_LOG(ERROR) << "Deserialization failed when '" << message.getElementAtIndex(2).c_str() - << "' was provided\n"; + IOX_LOG(ERROR, + "Deserialization failed when '" << message.getElementAtIndex(2).c_str() << "' was provided\n"); break; } @@ -361,8 +369,9 @@ void RouDi::processMessage(const runtime::IpcMessage& message, popo::SubscriberOptions::deserialize(cxx::Serialization(message.getElementAtIndex(3))); if (subscriberOptionsDeserializationResult.has_error()) { - IOX_LOG(ERROR) << "Deserialization of 'SubscriberOptions' failed when '" - << message.getElementAtIndex(3).c_str() << "' was provided\n"; + IOX_LOG(ERROR, + "Deserialization of 'SubscriberOptions' failed when '" << message.getElementAtIndex(3).c_str() + << "' was provided\n"); break; } const auto& subscriberOptions = subscriberOptionsDeserializationResult.value(); @@ -378,8 +387,9 @@ void RouDi::processMessage(const runtime::IpcMessage& message, { if (message.getNumberOfElements() != 5) { - IOX_LOG(ERROR) << "Wrong number of parameters for \"IpcMessageType::CREATE_CLIENT\" from \"" << runtimeName - << "\"received!"; + IOX_LOG(ERROR, + "Wrong number of parameters for \"IpcMessageType::CREATE_CLIENT\" from \"" << runtimeName + << "\"received!"); } else { @@ -387,8 +397,8 @@ void RouDi::processMessage(const runtime::IpcMessage& message, capro::ServiceDescription::deserialize(cxx::Serialization(message.getElementAtIndex(2))); if (deserializationResult.has_error()) { - IOX_LOG(ERROR) << "Deserialization failed when '" << message.getElementAtIndex(2).c_str() - << "' was provided\n"; + IOX_LOG(ERROR, + "Deserialization failed when '" << message.getElementAtIndex(2).c_str() << "' was provided\n"); break; } @@ -398,8 +408,9 @@ void RouDi::processMessage(const runtime::IpcMessage& message, popo::ClientOptions::deserialize(cxx::Serialization(message.getElementAtIndex(3))); if (clientOptionsDeserializationResult.has_error()) { - IOX_LOG(ERROR) << "Deserialization of 'ClientOptions' failed when '" - << message.getElementAtIndex(3).c_str() << "' was provided\n"; + IOX_LOG(ERROR, + "Deserialization of 'ClientOptions' failed when '" << message.getElementAtIndex(3).c_str() + << "' was provided\n"); break; } const auto& clientOptions = clientOptionsDeserializationResult.value(); @@ -414,8 +425,9 @@ void RouDi::processMessage(const runtime::IpcMessage& message, { if (message.getNumberOfElements() != 5) { - IOX_LOG(ERROR) << "Wrong number of parameters for \"IpcMessageType::CREATE_SERVER\" from \"" << runtimeName - << "\"received!"; + IOX_LOG(ERROR, + "Wrong number of parameters for \"IpcMessageType::CREATE_SERVER\" from \"" << runtimeName + << "\"received!"); } else { @@ -423,8 +435,8 @@ void RouDi::processMessage(const runtime::IpcMessage& message, capro::ServiceDescription::deserialize(cxx::Serialization(message.getElementAtIndex(2))); if (deserializationResult.has_error()) { - IOX_LOG(ERROR) << "Deserialization failed when '" << message.getElementAtIndex(2).c_str() - << "' was provided\n"; + IOX_LOG(ERROR, + "Deserialization failed when '" << message.getElementAtIndex(2).c_str() << "' was provided\n"); break; } @@ -434,8 +446,9 @@ void RouDi::processMessage(const runtime::IpcMessage& message, popo::ServerOptions::deserialize(cxx::Serialization(message.getElementAtIndex(3))); if (serverOptionsDeserializationResult.has_error()) { - IOX_LOG(ERROR) << "Deserialization of 'ServerOptions' failed when '" - << message.getElementAtIndex(3).c_str() << "' was provided\n"; + IOX_LOG(ERROR, + "Deserialization of 'ServerOptions' failed when '" << message.getElementAtIndex(3).c_str() + << "' was provided\n"); break; } const auto& serverOptions = serverOptionsDeserializationResult.value(); @@ -450,8 +463,9 @@ void RouDi::processMessage(const runtime::IpcMessage& message, { if (message.getNumberOfElements() != 2) { - IOX_LOG(ERROR) << "Wrong number of parameters for \"IpcMessageType::CREATE_CONDITION_VARIABLE\" from \"" - << runtimeName << "\"received!"; + IOX_LOG(ERROR, + "Wrong number of parameters for \"IpcMessageType::CREATE_CONDITION_VARIABLE\" from \"" + << runtimeName << "\"received!"); } else { @@ -463,8 +477,9 @@ void RouDi::processMessage(const runtime::IpcMessage& message, { if (message.getNumberOfElements() != 4) { - IOX_LOG(ERROR) << "Wrong number of parameters for \"IpcMessageType::CREATE_INTERFACE\" from \"" - << runtimeName << "\"received!"; + IOX_LOG(ERROR, + "Wrong number of parameters for \"IpcMessageType::CREATE_INTERFACE\" from \"" << runtimeName + << "\"received!"); } else { @@ -480,8 +495,9 @@ void RouDi::processMessage(const runtime::IpcMessage& message, { if (message.getNumberOfElements() != 3) { - IOX_LOG(ERROR) << "Wrong number of parameters for \"IpcMessageType::CREATE_NODE\" from \"" << runtimeName - << "\"received!"; + IOX_LOG(ERROR, + "Wrong number of parameters for \"IpcMessageType::CREATE_NODE\" from \"" << runtimeName + << "\"received!"); } else { @@ -499,8 +515,9 @@ void RouDi::processMessage(const runtime::IpcMessage& message, { if (message.getNumberOfElements() != 2) { - IOX_LOG(ERROR) << "Wrong number of parameters for \"IpcMessageType::PREPARE_APP_TERMINATION\" from \"" - << runtimeName << "\"received!"; + IOX_LOG(ERROR, + "Wrong number of parameters for \"IpcMessageType::PREPARE_APP_TERMINATION\" from \"" + << runtimeName << "\"received!"); } else { @@ -513,8 +530,9 @@ void RouDi::processMessage(const runtime::IpcMessage& message, { if (message.getNumberOfElements() != 2) { - IOX_LOG(ERROR) << "Wrong number of parameters for \"IpcMessageType::TERMINATION\" from \"" << runtimeName - << "\"received!"; + IOX_LOG(ERROR, + "Wrong number of parameters for \"IpcMessageType::TERMINATION\" from \"" << runtimeName + << "\"received!"); } else { @@ -524,7 +542,7 @@ void RouDi::processMessage(const runtime::IpcMessage& message, } default: { - IOX_LOG(ERROR) << "Unknown IPC message command [" << runtime::IpcMessageTypeToString(cmd) << "]"; + IOX_LOG(ERROR, "Unknown IPC message command [" << runtime::IpcMessageTypeToString(cmd) << "]"); m_prcMgr->sendMessageNotSupportedToRuntime(runtimeName); break; diff --git a/iceoryx_posh/source/roudi/roudi_cmd_line_parser.cpp b/iceoryx_posh/source/roudi/roudi_cmd_line_parser.cpp index 2028206e1b8..bd9ee378e40 100644 --- a/iceoryx_posh/source/roudi/roudi_cmd_line_parser.cpp +++ b/iceoryx_posh/source/roudi/roudi_cmd_line_parser.cpp @@ -102,7 +102,7 @@ CmdLineParser::parse(int argc, char* argv[], const CmdLineArgumentParsingMode cm constexpr uint64_t MAX_ROUDI_ID = ((1 << 16) - 1); if (!cxx::convert::fromString(optarg, roudiId)) { - IOX_LOG(ERROR) << "The RouDi id must be in the range of [0, " << MAX_ROUDI_ID << "]"; + IOX_LOG(ERROR, "The RouDi id must be in the range of [0, " << MAX_ROUDI_ID << "]"); m_cmdLineArgs.run = false; } @@ -122,7 +122,7 @@ CmdLineParser::parse(int argc, char* argv[], const CmdLineArgumentParsingMode cm else { m_cmdLineArgs.run = false; - IOX_LOG(ERROR) << "Options for monitoring-mode are 'on' and 'off'!"; + IOX_LOG(ERROR, "Options for monitoring-mode are 'on' and 'off'!"); } break; } @@ -159,8 +159,8 @@ CmdLineParser::parse(int argc, char* argv[], const CmdLineArgumentParsingMode cm else { m_cmdLineArgs.run = false; - IOX_LOG(ERROR) << "Options for log-level are 'off', 'fatal', 'error', 'warning', 'info', 'debug' and " - "'trace'!"; + IOX_LOG(ERROR, + "Options for log-level are 'off', 'fatal', 'error', 'warning', 'info', 'debug' and 'trace'!"); } break; } @@ -170,8 +170,9 @@ CmdLineParser::parse(int argc, char* argv[], const CmdLineArgumentParsingMode cm constexpr uint64_t MAX_PROCESS_TERMINATION_DELAY = std::numeric_limits::max(); if (!cxx::convert::fromString(optarg, processTerminationDelayInSeconds)) { - IOX_LOG(ERROR) << "The process termination delay must be in the range of [0, " - << MAX_PROCESS_TERMINATION_DELAY << "]"; + IOX_LOG(ERROR, + "The process termination delay must be in the range of [0, " << MAX_PROCESS_TERMINATION_DELAY + << "]"); m_cmdLineArgs.run = false; } else @@ -186,8 +187,7 @@ CmdLineParser::parse(int argc, char* argv[], const CmdLineArgumentParsingMode cm constexpr uint64_t MAX_PROCESS_KILL_DELAY = std::numeric_limits::max(); if (!cxx::convert::fromString(optarg, processKillDelayInSeconds)) { - IOX_LOG(ERROR) << "The process kill delay must be in the range of [0, " << MAX_PROCESS_KILL_DELAY - << "]"; + IOX_LOG(ERROR, "The process kill delay must be in the range of [0, " << MAX_PROCESS_KILL_DELAY << "]"); m_cmdLineArgs.run = false; } else @@ -225,8 +225,8 @@ CmdLineParser::parse(int argc, char* argv[], const CmdLineArgumentParsingMode cm else { m_cmdLineArgs.run = false; - IOX_LOG(ERROR) - << "Options for compatibility are 'off', 'major', 'minor', 'patch', 'commitId' and 'buildDate'!"; + IOX_LOG(ERROR, + "Options for compatibility are 'off', 'major', 'minor', 'patch', 'commitId' and 'buildDate'!"); } break; } diff --git a/iceoryx_posh/source/roudi/roudi_config_toml_file_provider.cpp b/iceoryx_posh/source/roudi/roudi_config_toml_file_provider.cpp index 41523fbe0dc..a10687621a3 100644 --- a/iceoryx_posh/source/roudi/roudi_config_toml_file_provider.cpp +++ b/iceoryx_posh/source/roudi/roudi_config_toml_file_provider.cpp @@ -45,13 +45,14 @@ TomlRouDiConfigFileProvider::TomlRouDiConfigFileProvider(config::CmdLineArgs_t& cxx::FileReader configFile(defaultConfigFilePath, "", cxx::FileReader::ErrorMode::Ignore); if (configFile.isOpen()) { - IOX_LOG(INFO) << "No config file provided. Using '" << defaultConfigFilePath << "'"; + IOX_LOG(INFO, "No config file provided. Using '" << defaultConfigFilePath << "'"); m_customConfigFilePath = defaultConfigFilePath; } else { - IOX_LOG(INFO) << "No config file provided and also not found at '" << defaultConfigFilePath - << "'. Falling back to built-in config."; + IOX_LOG(INFO, + "No config file provided and also not found at '" << defaultConfigFilePath + << "'. Falling back to built-in config."); } } else @@ -74,7 +75,7 @@ iox::expected TomlRou std::ifstream fileStream{m_customConfigFilePath.c_str()}; if (!fileStream.is_open()) { - IOX_LOG(ERROR) << "Could not open config file from path '" << m_customConfigFilePath << "'"; + IOX_LOG(ERROR, "Could not open config file from path '" << m_customConfigFilePath << "'"); return iox::err(iox::roudi::RouDiConfigFileParseError::FILE_OPEN_FAILED); } @@ -95,8 +96,8 @@ TomlRouDiConfigFileProvider::parse(std::istream& stream) noexcept { auto parserError = iox::roudi::RouDiConfigFileParseError::EXCEPTION_IN_PARSER; auto errorStringIndex = static_cast(parserError); - IOX_LOG(WARN) << iox::roudi::ROUDI_CONFIG_FILE_PARSE_ERROR_STRINGS[errorStringIndex] << ": " - << parserException.what(); + IOX_LOG(WARN, + iox::roudi::ROUDI_CONFIG_FILE_PARSE_ERROR_STRINGS[errorStringIndex] << ": " << parserException.what()); return iox::err(parserError); } diff --git a/iceoryx_posh/source/runtime/ipc_interface_base.cpp b/iceoryx_posh/source/runtime/ipc_interface_base.cpp index 49f6b6cf851..fed32e5a7db 100644 --- a/iceoryx_posh/source/runtime/ipc_interface_base.cpp +++ b/iceoryx_posh/source/runtime/ipc_interface_base.cpp @@ -69,8 +69,9 @@ IpcInterface::IpcInterface(const RuntimeName_t& runtimeName, m_maxMessageSize = messageSize; if (m_maxMessageSize > platform::IoxIpcChannelType::MAX_MESSAGE_SIZE) { - IOX_LOG(WARN) << "Message size too large, reducing from " << messageSize << " to " - << platform::IoxIpcChannelType::MAX_MESSAGE_SIZE; + IOX_LOG(WARN, + "Message size too large, reducing from " << messageSize << " to " + << platform::IoxIpcChannelType::MAX_MESSAGE_SIZE); m_maxMessageSize = platform::IoxIpcChannelType::MAX_MESSAGE_SIZE; } } @@ -80,8 +81,7 @@ bool IpcInterface::receive(IpcMessage& answer) const noexcept { if (!m_ipcChannel.has_value()) { - IOX_LOG(WARN) << "Trying to receive data on an non-initialized IPC interface! Interface name: " - << m_runtimeName; + IOX_LOG(WARN, "Trying to receive data on an non-initialized IPC interface! Interface name: " << m_runtimeName); return false; } @@ -99,8 +99,7 @@ bool IpcInterface::timedReceive(const units::Duration timeout, I { if (!m_ipcChannel.has_value()) { - IOX_LOG(WARN) << "Trying to receive data on an non-initialized IPC interface! Interface name: " - << m_runtimeName; + IOX_LOG(WARN, "Trying to receive data on an non-initialized IPC interface! Interface name: " << m_runtimeName); return false; } @@ -118,7 +117,7 @@ bool IpcInterface::setMessageFromString(const char* buffer, IpcM answer.setMessage(buffer); if (!answer.isValid()) { - IOX_LOG(ERROR) << "The received message " << answer.getMessage() << " is not valid"; + IOX_LOG(ERROR, "The received message " << answer.getMessage() << " is not valid"); return false; } return true; @@ -129,14 +128,15 @@ bool IpcInterface::send(const IpcMessage& msg) const noexcept { if (!m_ipcChannel.has_value()) { - IOX_LOG(WARN) << "Trying to send data on an non-initialized IPC interface! Interface name: " << m_runtimeName; + IOX_LOG(WARN, "Trying to send data on an non-initialized IPC interface! Interface name: " << m_runtimeName); return false; } if (!msg.isValid()) { - IOX_LOG(ERROR) << "Trying to send the message " << msg.getMessage() << " which " - << "does not follow the specified syntax."; + IOX_LOG(ERROR, + "Trying to send the message " << msg.getMessage() << " which " + << "does not follow the specified syntax."); return false; } @@ -144,7 +144,7 @@ bool IpcInterface::send(const IpcMessage& msg) const noexcept if (error == posix::IpcChannelError::MESSAGE_TOO_LONG) { const uint64_t messageSize = msg.getMessage().size() + platform::IoxIpcChannelType::NULL_TERMINATOR_SIZE; - IOX_LOG(ERROR) << "msg size of " << messageSize << " bigger than configured max message size"; + IOX_LOG(ERROR, "msg size of " << messageSize << " bigger than configured max message size"); } }; return !m_ipcChannel->send(msg.getMessage()).or_else(logLengthError).has_error(); @@ -155,14 +155,15 @@ bool IpcInterface::timedSend(const IpcMessage& msg, units::Durat { if (!m_ipcChannel.has_value()) { - IOX_LOG(WARN) << "Trying to send data on an non-initialized IPC interface! Interface name: " << m_runtimeName; + IOX_LOG(WARN, "Trying to send data on an non-initialized IPC interface! Interface name: " << m_runtimeName); return false; } if (!msg.isValid()) { - IOX_LOG(ERROR) << "Trying to send the message " << msg.getMessage() << " which " - << "does not follow the specified syntax."; + IOX_LOG(ERROR, + "Trying to send the message " << msg.getMessage() << " which " + << "does not follow the specified syntax."); return false; } @@ -170,7 +171,7 @@ bool IpcInterface::timedSend(const IpcMessage& msg, units::Durat if (error == posix::IpcChannelError::MESSAGE_TOO_LONG) { const uint64_t messageSize = msg.getMessage().size() + platform::IoxIpcChannelType::NULL_TERMINATOR_SIZE; - IOX_LOG(ERROR) << "msg size of " << messageSize << " bigger than configured max message size"; + IOX_LOG(ERROR, "msg size of " << messageSize << " bigger than configured max message size"); } }; return !m_ipcChannel->timedSend(msg.getMessage(), timeout).or_else(logLengthError).has_error(); @@ -204,16 +205,18 @@ bool IpcInterface::openIpcChannel(const posix::IpcChannelSide ch .or_else([this](auto& err) { if (this->m_channelSide == posix::IpcChannelSide::SERVER) { - IOX_LOG(ERROR) << "Unable to create ipc channel '" << this->m_runtimeName - << "'. Error code: " << static_cast(err); + IOX_LOG(ERROR, + "Unable to create ipc channel '" << this->m_runtimeName + << "'. Error code: " << static_cast(err)); } else { // the client opens the channel and tries to do this in a loop when the channel is not available, // therefore resulting in a wall of error messages on the console which leads to missing the important // one that roudi is not running if this would be LogLevel::ERROR instead of LogLevel::TRACE - IOX_LOG(TRACE) << "Unable to open ipc channel '" << this->m_runtimeName - << "'. Error code: " << static_cast(err); + IOX_LOG(TRACE, + "Unable to open ipc channel '" << this->m_runtimeName + << "'. Error code: " << static_cast(err)); } }); @@ -255,7 +258,7 @@ void IpcInterface::cleanupOutdatedIpcChannel(const RuntimeName_t { if (platform::IoxIpcChannelType::unlinkIfExists(name).value_or(false)) { - IOX_LOG(WARN) << "IPC channel still there, doing an unlink of '" << name << "'"; + IOX_LOG(WARN, "IPC channel still there, doing an unlink of '" << name << "'"); } } diff --git a/iceoryx_posh/source/runtime/ipc_interface_creator.cpp b/iceoryx_posh/source/runtime/ipc_interface_creator.cpp index 57578f48550..ce3e4424356 100644 --- a/iceoryx_posh/source/runtime/ipc_interface_creator.cpp +++ b/iceoryx_posh/source/runtime/ipc_interface_creator.cpp @@ -35,14 +35,15 @@ IpcInterfaceCreator::IpcInterfaceCreator(const RuntimeName_t& runtimeName, .or_else([&runtimeName](auto& error) { if (error == posix::FileLockError::LOCKED_BY_OTHER_PROCESS) { - IOX_LOG(FATAL) << "An application with the name " << runtimeName - << " is still running. Using the " - "same name twice is not supported."; + IOX_LOG(FATAL, + "An application with the name " << runtimeName + << " is still running. Using the " + "same name twice is not supported."); errorHandler(PoshError::IPC_INTERFACE__APP_WITH_SAME_NAME_STILL_RUNNING, iox::ErrorLevel::FATAL); } else { - IOX_LOG(FATAL) << "Error occurred while acquiring file lock named " << runtimeName; + IOX_LOG(FATAL, "Error occurred while acquiring file lock named " << runtimeName); errorHandler(PoshError::IPC_INTERFACE__COULD_NOT_ACQUIRE_FILE_LOCK, iox::ErrorLevel::FATAL); } }) diff --git a/iceoryx_posh/source/runtime/ipc_runtime_interface.cpp b/iceoryx_posh/source/runtime/ipc_runtime_interface.cpp index 59711319eee..4b136292929 100644 --- a/iceoryx_posh/source/runtime/ipc_runtime_interface.cpp +++ b/iceoryx_posh/source/runtime/ipc_runtime_interface.cpp @@ -58,7 +58,7 @@ IpcRuntimeInterface::IpcRuntimeInterface(const RuntimeName_t& roudiName, { if (!m_RoudiIpcInterface.isInitialized() || !m_RoudiIpcInterface.ipcChannelMapsToFile()) { - IOX_LOG(DEBUG) << "reopen RouDi's IPC channel!"; + IOX_LOG(DEBUG, "reopen RouDi's IPC channel!"); m_RoudiIpcInterface.reopen(); regState = RegState::WAIT_FOR_ROUDI; } @@ -130,7 +130,7 @@ IpcRuntimeInterface::IpcRuntimeInterface(const RuntimeName_t& roudiName, switch (regState) { case RegState::WAIT_FOR_ROUDI: - IOX_LOG(FATAL) << "Timeout registering at RouDi. Is RouDi running?"; + IOX_LOG(FATAL, "Timeout registering at RouDi. Is RouDi running?"); errorHandler(PoshError::IPC_INTERFACE__REG_ROUDI_NOT_AVAILABLE); break; case RegState::SEND_REGISTER_REQUEST: @@ -163,13 +163,13 @@ bool IpcRuntimeInterface::sendRequestToRouDi(const IpcMessage& msg, IpcMessage& { if (!m_RoudiIpcInterface.send(msg)) { - IOX_LOG(ERROR) << "Could not send request via RouDi IPC channel interface.\n"; + IOX_LOG(ERROR, "Could not send request via RouDi IPC channel interface.\n"); return false; } if (!m_AppIpcInterface->receive(answer)) { - IOX_LOG(ERROR) << "Could not receive request via App IPC channel interface.\n"; + IOX_LOG(ERROR, "Could not receive request via App IPC channel interface.\n"); return false; } @@ -192,13 +192,13 @@ void IpcRuntimeInterface::waitForRoudi(deadline_timer& timer) noexcept if (m_RoudiIpcInterface.isInitialized()) { - IOX_LOG(DEBUG) << "RouDi IPC Channel found!"; + IOX_LOG(DEBUG, "RouDi IPC Channel found!"); break; } if (printWaitingWarning) { - IOX_LOG(WARN) << "RouDi not found - waiting ..."; + IOX_LOG(WARN, "RouDi not found - waiting ..."); printWaitingWarning = false; printFoundMessage = true; } @@ -215,7 +215,7 @@ void IpcRuntimeInterface::waitForRoudi(deadline_timer& timer) noexcept if (printFoundMessage && m_RoudiIpcInterface.isInitialized()) { - IOX_LOG(WARN) << "... RouDi found."; + IOX_LOG(WARN, "... RouDi found."); } } @@ -257,12 +257,12 @@ IpcRuntimeInterface::RegAckResult IpcRuntimeInterface::waitForRegAck(int64_t tra } else { - IOX_LOG(WARN) << "Received a REG_ACK with an outdated timestamp!"; + IOX_LOG(WARN, "Received a REG_ACK with an outdated timestamp!"); } } else { - IOX_LOG(ERROR) << "Wrong response received " << receiveBuffer.getMessage(); + IOX_LOG(ERROR, "Wrong response received " << receiveBuffer.getMessage()); } } } diff --git a/iceoryx_posh/source/runtime/node_property.cpp b/iceoryx_posh/source/runtime/node_property.cpp index d3187a8e78b..ee23759b133 100644 --- a/iceoryx_posh/source/runtime/node_property.cpp +++ b/iceoryx_posh/source/runtime/node_property.cpp @@ -33,7 +33,7 @@ NodeProperty::NodeProperty(const cxx::Serialization& serialized) noexcept { if (!serialized.extract(m_name, m_nodeDeviceIdentifier)) { - IOX_LOG(ERROR) << "unable to create NodeProperty from serialized string " << serialized.toString(); + IOX_LOG(ERROR, "unable to create NodeProperty from serialized string " << serialized.toString()); } } diff --git a/iceoryx_posh/source/runtime/posh_runtime.cpp b/iceoryx_posh/source/runtime/posh_runtime.cpp index 8a9c30409d8..1bd9cbd948d 100644 --- a/iceoryx_posh/source/runtime/posh_runtime.cpp +++ b/iceoryx_posh/source/runtime/posh_runtime.cpp @@ -70,7 +70,7 @@ void PoshRuntime::setRuntimeFactory(const factory_t& factory) noexcept } else { - IOX_LOG(FATAL) << "Cannot set runtime factory. Passed factory must not be empty!"; + IOX_LOG(FATAL, "Cannot set runtime factory. Passed factory must not be empty!"); errorHandler(PoshError::POSH__RUNTIME_FACTORY_IS_NOT_SET); } } @@ -122,7 +122,7 @@ PoshRuntime::PoshRuntime(optional name) noexcept { if (internal::isCompiledOn32BitSystem()) { - IOX_LOG(WARN) << "Running applications on 32-bit architectures is not supported! Use at your own risk!"; + IOX_LOG(WARN, "Running applications on 32-bit architectures is not supported! Use at your own risk!"); } } @@ -130,13 +130,14 @@ const RuntimeName_t& PoshRuntime::verifyInstanceName(optional MAX_HISTORY_CAPACITY) { - IOX_LOG(WARN) << "Requested history capacity " << options.historyCapacity - << " exceeds the maximum possible one for this publisher" - << ", limiting from " << publisherOptions.historyCapacity << " to " << MAX_HISTORY_CAPACITY; + IOX_LOG(WARN, + "Requested history capacity " + << options.historyCapacity << " exceeds the maximum possible one for this publisher" + << ", limiting from " << publisherOptions.historyCapacity << " to " << MAX_HISTORY_CAPACITY); options.historyCapacity = MAX_HISTORY_CAPACITY; } @@ -113,38 +115,40 @@ PoshRuntimeImpl::getMiddlewarePublisher(const capro::ServiceDescription& service switch (maybePublisher.error()) { case IpcMessageErrorType::NO_UNIQUE_CREATED: - IOX_LOG(WARN) << "Service '" << service << "' already in use by another process."; + IOX_LOG(WARN, "Service '" << service << "' already in use by another process."); errorHandler(PoshError::POSH__RUNTIME_PUBLISHER_PORT_NOT_UNIQUE, iox::ErrorLevel::SEVERE); break; case IpcMessageErrorType::INTERNAL_SERVICE_DESCRIPTION_IS_FORBIDDEN: - IOX_LOG(WARN) << "Usage of internal service '" << service << "' is forbidden."; + IOX_LOG(WARN, "Usage of internal service '" << service << "' is forbidden."); errorHandler(PoshError::POSH__RUNTIME_SERVICE_DESCRIPTION_FORBIDDEN, iox::ErrorLevel::SEVERE); break; case IpcMessageErrorType::PUBLISHER_LIST_FULL: - IOX_LOG(WARN) << "Service '" << service - << "' could not be created since we are out of memory for publishers."; + IOX_LOG(WARN, + "Service '" << service << "' could not be created since we are out of memory for publishers."); errorHandler(PoshError::POSH__RUNTIME_ROUDI_PUBLISHER_LIST_FULL, iox::ErrorLevel::SEVERE); break; case IpcMessageErrorType::REQUEST_PUBLISHER_INVALID_RESPONSE: - IOX_LOG(WARN) << "Service '" << service - << "' could not be created. Request publisher got invalid response."; + IOX_LOG(WARN, "Service '" << service << "' could not be created. Request publisher got invalid response."); errorHandler(PoshError::POSH__RUNTIME_ROUDI_REQUEST_PUBLISHER_INVALID_RESPONSE, iox::ErrorLevel::SEVERE); break; case IpcMessageErrorType::REQUEST_PUBLISHER_WRONG_IPC_MESSAGE_RESPONSE: - IOX_LOG(WARN) << "Service '" << service - << "' could not be created. Request publisher got wrong IPC channel response."; + IOX_LOG(WARN, + "Service '" << service + << "' could not be created. Request publisher got wrong IPC channel response."); errorHandler(PoshError::POSH__RUNTIME_ROUDI_REQUEST_PUBLISHER_WRONG_IPC_MESSAGE_RESPONSE, iox::ErrorLevel::SEVERE); break; case IpcMessageErrorType::REQUEST_PUBLISHER_NO_WRITABLE_SHM_SEGMENT: - IOX_LOG(WARN) - << "Service '" << service - << "' could not be created. RouDi did not find a writable shared memory segment for the current " - "user. Try using another user or adapt RouDi's config."; + IOX_LOG( + WARN, + "Service '" + << service + << "' could not be created. RouDi did not find a writable shared memory segment for the current " + "user. Try using another user or adapt RouDi's config."); errorHandler(PoshError::POSH__RUNTIME_NO_WRITABLE_SHM_SEGMENT, iox::ErrorLevel::SEVERE); break; default: - IOX_LOG(WARN) << "Unknown error occurred while creating service '" << service << "'."; + IOX_LOG(WARN, "Unknown error occurred while creating service '" << service << "'."); errorHandler(PoshError::POSH__RUNTIME_PUBLISHER_PORT_CREATION_UNKNOWN_ERROR, iox::ErrorLevel::SEVERE); break; } @@ -159,7 +163,7 @@ PoshRuntimeImpl::requestPublisherFromRoudi(const IpcMessage& sendBuffer) noexcep IpcMessage receiveBuffer; if (sendRequestToRouDi(sendBuffer, receiveBuffer) == false) { - IOX_LOG(ERROR) << "Request publisher got invalid response!"; + IOX_LOG(ERROR, "Request publisher got invalid response!"); return err(IpcMessageErrorType::REQUEST_PUBLISHER_INVALID_RESPONSE); } else if (receiveBuffer.getNumberOfElements() == 3U) @@ -183,12 +187,12 @@ PoshRuntimeImpl::requestPublisherFromRoudi(const IpcMessage& sendBuffer) noexcep std::string IpcMessage2 = receiveBuffer.getElementAtIndex(1U); if (stringToIpcMessageType(IpcMessage1.c_str()) == IpcMessageType::ERROR) { - IOX_LOG(ERROR) << "Request publisher received no valid publisher port from RouDi."; + IOX_LOG(ERROR, "Request publisher received no valid publisher port from RouDi."); return err(stringToIpcMessageErrorType(IpcMessage2.c_str())); } } - IOX_LOG(ERROR) << "Request publisher got wrong response from IPC channel :'" << receiveBuffer.getMessage() << "'"; + IOX_LOG(ERROR, "Request publisher got wrong response from IPC channel :'" << receiveBuffer.getMessage() << "'"); return err(IpcMessageErrorType::REQUEST_PUBLISHER_WRONG_IPC_MESSAGE_RESPONSE); } @@ -202,22 +206,25 @@ PoshRuntimeImpl::getMiddlewareSubscriber(const capro::ServiceDescription& servic auto options = subscriberOptions; if (options.queueCapacity > MAX_QUEUE_CAPACITY) { - IOX_LOG(WARN) << "Requested queue capacity " << options.queueCapacity - << " exceeds the maximum possible one for this subscriber" - << ", limiting from " << subscriberOptions.queueCapacity << " to " << MAX_QUEUE_CAPACITY; + IOX_LOG(WARN, + "Requested queue capacity " + << options.queueCapacity << " exceeds the maximum possible one for this subscriber" + << ", limiting from " << subscriberOptions.queueCapacity << " to " << MAX_QUEUE_CAPACITY); options.queueCapacity = MAX_QUEUE_CAPACITY; } else if (0U == options.queueCapacity) { - IOX_LOG(WARN) << "Requested queue capacity of 0 doesn't make sense as no data would be received," - << " the capacity is set to 1"; + IOX_LOG(WARN, + "Requested queue capacity of 0 doesn't make sense as no data would be received," + << " the capacity is set to 1"); options.queueCapacity = 1U; } if (subscriberOptions.historyRequest > subscriberOptions.queueCapacity) { - IOX_LOG(WARN) << "Requested historyRequest for " << service - << " is larger than queueCapacity. Clamping historyRequest to queueCapacity!"; + IOX_LOG(WARN, + "Requested historyRequest for " + << service << " is larger than queueCapacity. Clamping historyRequest to queueCapacity!"); options.historyRequest = subscriberOptions.queueCapacity; } @@ -238,23 +245,23 @@ PoshRuntimeImpl::getMiddlewareSubscriber(const capro::ServiceDescription& servic switch (maybeSubscriber.error()) { case IpcMessageErrorType::SUBSCRIBER_LIST_FULL: - IOX_LOG(WARN) << "Service '" << service - << "' could not be created since we are out of memory for subscribers."; + IOX_LOG(WARN, + "Service '" << service << "' could not be created since we are out of memory for subscribers."); errorHandler(PoshError::POSH__RUNTIME_ROUDI_SUBSCRIBER_LIST_FULL, iox::ErrorLevel::SEVERE); break; case IpcMessageErrorType::REQUEST_SUBSCRIBER_INVALID_RESPONSE: - IOX_LOG(WARN) << "Service '" << service - << "' could not be created. Request subscriber got invalid response."; + IOX_LOG(WARN, "Service '" << service << "' could not be created. Request subscriber got invalid response."); errorHandler(PoshError::POSH__RUNTIME_ROUDI_REQUEST_SUBSCRIBER_INVALID_RESPONSE, iox::ErrorLevel::SEVERE); break; case IpcMessageErrorType::REQUEST_SUBSCRIBER_WRONG_IPC_MESSAGE_RESPONSE: - IOX_LOG(WARN) << "Service '" << service - << "' could not be created. Request subscriber got wrong IPC channel response."; + IOX_LOG(WARN, + "Service '" << service + << "' could not be created. Request subscriber got wrong IPC channel response."); errorHandler(PoshError::POSH__RUNTIME_ROUDI_REQUEST_SUBSCRIBER_WRONG_IPC_MESSAGE_RESPONSE, iox::ErrorLevel::SEVERE); break; default: - IOX_LOG(WARN) << "Unknown error occurred while creating service '" << service << "'."; + IOX_LOG(WARN, "Unknown error occurred while creating service '" << service << "'."); errorHandler(PoshError::POSH__RUNTIME_SUBSCRIBER_PORT_CREATION_UNKNOWN_ERROR, iox::ErrorLevel::SEVERE); break; } @@ -269,7 +276,7 @@ PoshRuntimeImpl::requestSubscriberFromRoudi(const IpcMessage& sendBuffer) noexce IpcMessage receiveBuffer; if (sendRequestToRouDi(sendBuffer, receiveBuffer) == false) { - IOX_LOG(ERROR) << "Request subscriber got invalid response!"; + IOX_LOG(ERROR, "Request subscriber got invalid response!"); return err(IpcMessageErrorType::REQUEST_SUBSCRIBER_INVALID_RESPONSE); } else if (receiveBuffer.getNumberOfElements() == 3U) @@ -293,12 +300,12 @@ PoshRuntimeImpl::requestSubscriberFromRoudi(const IpcMessage& sendBuffer) noexce if (stringToIpcMessageType(IpcMessage1.c_str()) == IpcMessageType::ERROR) { - IOX_LOG(ERROR) << "Request subscriber received no valid subscriber port from RouDi."; + IOX_LOG(ERROR, "Request subscriber received no valid subscriber port from RouDi."); return err(stringToIpcMessageErrorType(IpcMessage2.c_str())); } } - IOX_LOG(ERROR) << "Request subscriber got wrong response from IPC channel :'" << receiveBuffer.getMessage() << "'"; + IOX_LOG(ERROR, "Request subscriber got wrong response from IPC channel :'" << receiveBuffer.getMessage() << "'"); return err(IpcMessageErrorType::REQUEST_SUBSCRIBER_WRONG_IPC_MESSAGE_RESPONSE); } @@ -310,15 +317,17 @@ popo::ClientPortUser::MemberType_t* PoshRuntimeImpl::getMiddlewareClient(const c auto options = clientOptions; if (options.responseQueueCapacity > MAX_QUEUE_CAPACITY) { - IOX_LOG(WARN) << "Requested response queue capacity " << options.responseQueueCapacity - << " exceeds the maximum possible one for this client" - << ", limiting from " << options.responseQueueCapacity << " to " << MAX_QUEUE_CAPACITY; + IOX_LOG(WARN, + "Requested response queue capacity " + << options.responseQueueCapacity << " exceeds the maximum possible one for this client" + << ", limiting from " << options.responseQueueCapacity << " to " << MAX_QUEUE_CAPACITY); options.responseQueueCapacity = MAX_QUEUE_CAPACITY; } else if (options.responseQueueCapacity == 0U) { - IOX_LOG(WARN) << "Requested response queue capacity of 0 doesn't make sense as no data would be received," - << " the capacity is set to 1"; + IOX_LOG(WARN, + "Requested response queue capacity of 0 doesn't make sense as no data would be received," + << " the capacity is set to 1"); options.responseQueueCapacity = 1U; } @@ -333,31 +342,34 @@ popo::ClientPortUser::MemberType_t* PoshRuntimeImpl::getMiddlewareClient(const c switch (maybeClient.error()) { case IpcMessageErrorType::CLIENT_LIST_FULL: - IOX_LOG(WARN) << "Could not create client with service description '" << service - << "' as we are out of memory for clients."; + IOX_LOG(WARN, + "Could not create client with service description '" << service + << "' as we are out of memory for clients."); errorHandler(PoshError::POSH__RUNTIME_ROUDI_OUT_OF_CLIENTS, iox::ErrorLevel::SEVERE); break; case IpcMessageErrorType::REQUEST_CLIENT_INVALID_RESPONSE: - IOX_LOG(WARN) << "Could not create client with service description '" << service - << "'; received invalid response."; + IOX_LOG(WARN, + "Could not create client with service description '" << service << "'; received invalid response."); errorHandler(PoshError::POSH__RUNTIME_ROUDI_REQUEST_CLIENT_INVALID_RESPONSE, iox::ErrorLevel::SEVERE); break; case IpcMessageErrorType::REQUEST_CLIENT_WRONG_IPC_MESSAGE_RESPONSE: - IOX_LOG(WARN) << "Could not create client with service description '" << service - << "'; received wrong IPC channel response."; + IOX_LOG(WARN, + "Could not create client with service description '" << service + << "'; received wrong IPC channel response."); errorHandler(PoshError::POSH__RUNTIME_ROUDI_REQUEST_CLIENT_WRONG_IPC_MESSAGE_RESPONSE, iox::ErrorLevel::SEVERE); break; case IpcMessageErrorType::REQUEST_CLIENT_NO_WRITABLE_SHM_SEGMENT: - IOX_LOG(WARN) - << "Service '" << service - << "' could not be created. RouDi did not find a writable shared memory segment for the current " - "user. Try using another user or adapt RouDi's config."; + IOX_LOG( + WARN, + "Service '" + << service + << "' could not be created. RouDi did not find a writable shared memory segment for the current " + "user. Try using another user or adapt RouDi's config."); errorHandler(PoshError::POSH__RUNTIME_NO_WRITABLE_SHM_SEGMENT, iox::ErrorLevel::SEVERE); break; default: - IOX_LOG(WARN) << "Unknown error occurred while creating client with service description '" << service - << "'"; + IOX_LOG(WARN, "Unknown error occurred while creating client with service description '" << service << "'"); errorHandler(PoshError::POSH__RUNTIME_CLIENT_PORT_CREATION_UNKNOWN_ERROR, iox::ErrorLevel::SEVERE); break; } @@ -372,7 +384,7 @@ PoshRuntimeImpl::requestClientFromRoudi(const IpcMessage& sendBuffer) noexcept IpcMessage receiveBuffer; if (sendRequestToRouDi(sendBuffer, receiveBuffer) == false) { - IOX_LOG(ERROR) << "Request client got invalid response!"; + IOX_LOG(ERROR, "Request client got invalid response!"); return err(IpcMessageErrorType::REQUEST_CLIENT_INVALID_RESPONSE); } else if (receiveBuffer.getNumberOfElements() == 3U) @@ -395,13 +407,13 @@ PoshRuntimeImpl::requestClientFromRoudi(const IpcMessage& sendBuffer) noexcept std::string IpcMessage2 = receiveBuffer.getElementAtIndex(1U); if (stringToIpcMessageType(IpcMessage1.c_str()) == IpcMessageType::ERROR) { - IOX_LOG(ERROR) << "Request client received no valid client port from RouDi."; + IOX_LOG(ERROR, "Request client received no valid client port from RouDi."); return err(stringToIpcMessageErrorType(IpcMessage2.c_str())); } } - IOX_LOG(ERROR) << "Request client got wrong response from IPC channel :'" << receiveBuffer.getMessage() << "'"; + IOX_LOG(ERROR, "Request client got wrong response from IPC channel :'" << receiveBuffer.getMessage() << "'"); return err(IpcMessageErrorType::REQUEST_CLIENT_WRONG_IPC_MESSAGE_RESPONSE); } @@ -413,15 +425,17 @@ popo::ServerPortUser::MemberType_t* PoshRuntimeImpl::getMiddlewareServer(const c auto options = serverOptions; if (options.requestQueueCapacity > MAX_QUEUE_CAPACITY) { - IOX_LOG(WARN) << "Requested request queue capacity " << options.requestQueueCapacity - << " exceeds the maximum possible one for this server" - << ", limiting from " << options.requestQueueCapacity << " to " << MAX_QUEUE_CAPACITY; + IOX_LOG(WARN, + "Requested request queue capacity " + << options.requestQueueCapacity << " exceeds the maximum possible one for this server" + << ", limiting from " << options.requestQueueCapacity << " to " << MAX_QUEUE_CAPACITY); options.requestQueueCapacity = MAX_QUEUE_CAPACITY; } else if (options.requestQueueCapacity == 0U) { - IOX_LOG(WARN) << "Requested request queue capacity of 0 doesn't make sense as no data would be received," - << " the capacity is set to 1"; + IOX_LOG(WARN, + "Requested request queue capacity of 0 doesn't make sense as no data would be received," + << " the capacity is set to 1"); options.requestQueueCapacity = 1U; } @@ -436,31 +450,34 @@ popo::ServerPortUser::MemberType_t* PoshRuntimeImpl::getMiddlewareServer(const c switch (maybeServer.error()) { case IpcMessageErrorType::SERVER_LIST_FULL: - IOX_LOG(WARN) << "Could not create server with service description '" << service - << "' as we are out of memory for servers."; + IOX_LOG(WARN, + "Could not create server with service description '" << service + << "' as we are out of memory for servers."); errorHandler(PoshError::POSH__RUNTIME_ROUDI_OUT_OF_SERVERS, iox::ErrorLevel::SEVERE); break; case IpcMessageErrorType::REQUEST_SERVER_INVALID_RESPONSE: - IOX_LOG(WARN) << "Could not create server with service description '" << service - << "'; received invalid response."; + IOX_LOG(WARN, + "Could not create server with service description '" << service << "'; received invalid response."); errorHandler(PoshError::POSH__RUNTIME_ROUDI_REQUEST_SERVER_INVALID_RESPONSE, iox::ErrorLevel::SEVERE); break; case IpcMessageErrorType::REQUEST_SERVER_WRONG_IPC_MESSAGE_RESPONSE: - IOX_LOG(WARN) << "Could not create server with service description '" << service - << "'; received wrong IPC channel response."; + IOX_LOG(WARN, + "Could not create server with service description '" << service + << "'; received wrong IPC channel response."); errorHandler(PoshError::POSH__RUNTIME_ROUDI_REQUEST_SERVER_WRONG_IPC_MESSAGE_RESPONSE, iox::ErrorLevel::SEVERE); break; case IpcMessageErrorType::REQUEST_SERVER_NO_WRITABLE_SHM_SEGMENT: - IOX_LOG(WARN) - << "Service '" << service - << "' could not be created. RouDi did not find a writable shared memory segment for the current " - "user. Try using another user or adapt RouDi's config."; + IOX_LOG( + WARN, + "Service '" + << service + << "' could not be created. RouDi did not find a writable shared memory segment for the current " + "user. Try using another user or adapt RouDi's config."); errorHandler(PoshError::POSH__RUNTIME_NO_WRITABLE_SHM_SEGMENT, iox::ErrorLevel::SEVERE); break; default: - IOX_LOG(WARN) << "Unknown error occurred while creating server with service description '" << service - << "'"; + IOX_LOG(WARN, "Unknown error occurred while creating server with service description '" << service << "'"); errorHandler(PoshError::POSH__RUNTIME_SERVER_PORT_CREATION_UNKNOWN_ERROR, iox::ErrorLevel::SEVERE); break; } @@ -475,7 +492,7 @@ PoshRuntimeImpl::requestServerFromRoudi(const IpcMessage& sendBuffer) noexcept IpcMessage receiveBuffer; if (sendRequestToRouDi(sendBuffer, receiveBuffer) == false) { - IOX_LOG(ERROR) << "Request server got invalid response!"; + IOX_LOG(ERROR, "Request server got invalid response!"); return err(IpcMessageErrorType::REQUEST_SERVER_INVALID_RESPONSE); } else if (receiveBuffer.getNumberOfElements() == 3U) @@ -498,12 +515,12 @@ PoshRuntimeImpl::requestServerFromRoudi(const IpcMessage& sendBuffer) noexcept std::string IpcMessage2 = receiveBuffer.getElementAtIndex(1U); if (stringToIpcMessageType(IpcMessage1.c_str()) == IpcMessageType::ERROR) { - IOX_LOG(ERROR) << "Request server received no valid server port from RouDi."; + IOX_LOG(ERROR, "Request server received no valid server port from RouDi."); return err(stringToIpcMessageErrorType(IpcMessage2.c_str())); } } - IOX_LOG(ERROR) << "Request server got wrong response from IPC channel :'" << receiveBuffer.getMessage() << "'"; + IOX_LOG(ERROR, "Request server got wrong response from IPC channel :'" << receiveBuffer.getMessage() << "'"); return err(IpcMessageErrorType::REQUEST_SERVER_WRONG_IPC_MESSAGE_RESPONSE); } @@ -518,7 +535,7 @@ popo::InterfacePortData* PoshRuntimeImpl::getMiddlewareInterface(const capro::In if (sendRequestToRouDi(sendBuffer, receiveBuffer) == false) { - IOX_LOG(ERROR) << "Request interface got invalid response!"; + IOX_LOG(ERROR, "Request interface got invalid response!"); errorHandler(PoshError::POSH__RUNTIME_ROUDI_GET_MW_INTERFACE_INVALID_RESPONSE, iox::ErrorLevel::SEVERE); return nullptr; } @@ -537,7 +554,7 @@ popo::InterfacePortData* PoshRuntimeImpl::getMiddlewareInterface(const capro::In } } - IOX_LOG(ERROR) << "Get mw interface got wrong response from IPC channel :'" << receiveBuffer.getMessage() << "'"; + IOX_LOG(ERROR, "Get mw interface got wrong response from IPC channel :'" << receiveBuffer.getMessage() << "'"); errorHandler(PoshError::POSH__RUNTIME_ROUDI_GET_MW_INTERFACE_WRONG_IPC_MESSAGE_RESPONSE, iox::ErrorLevel::SEVERE); return nullptr; } @@ -552,7 +569,7 @@ NodeData* PoshRuntimeImpl::createNode(const NodeProperty& nodeProperty) noexcept if (sendRequestToRouDi(sendBuffer, receiveBuffer) == false) { - IOX_LOG(ERROR) << "Request node got invalid response!"; + IOX_LOG(ERROR, "Request node got invalid response!"); errorHandler(PoshError::POSH__RUNTIME_ROUDI_CREATE_NODE_INVALID_RESPONSE, iox::ErrorLevel::SEVERE); return nullptr; } @@ -571,7 +588,7 @@ NodeData* PoshRuntimeImpl::createNode(const NodeProperty& nodeProperty) noexcept } } - IOX_LOG(ERROR) << "Got wrong response from RouDi while creating node:'" << receiveBuffer.getMessage() << "'"; + IOX_LOG(ERROR, "Got wrong response from RouDi while creating node:'" << receiveBuffer.getMessage() << "'"); errorHandler(PoshError::POSH__RUNTIME_ROUDI_CREATE_NODE_WRONG_IPC_MESSAGE_RESPONSE, iox::ErrorLevel::SEVERE); return nullptr; } @@ -582,7 +599,7 @@ PoshRuntimeImpl::requestConditionVariableFromRoudi(const IpcMessage& sendBuffer) IpcMessage receiveBuffer; if (sendRequestToRouDi(sendBuffer, receiveBuffer) == false) { - IOX_LOG(ERROR) << "Request condition variable got invalid response!"; + IOX_LOG(ERROR, "Request condition variable got invalid response!"); return err(IpcMessageErrorType::REQUEST_CONDITION_VARIABLE_INVALID_RESPONSE); } else if (receiveBuffer.getNumberOfElements() == 3U) @@ -605,13 +622,13 @@ PoshRuntimeImpl::requestConditionVariableFromRoudi(const IpcMessage& sendBuffer) std::string IpcMessage2 = receiveBuffer.getElementAtIndex(1U); if (stringToIpcMessageType(IpcMessage1.c_str()) == IpcMessageType::ERROR) { - IOX_LOG(ERROR) << "Request condition variable received no valid condition variable port from RouDi."; + IOX_LOG(ERROR, "Request condition variable received no valid condition variable port from RouDi."); return err(stringToIpcMessageErrorType(IpcMessage2.c_str())); } } - IOX_LOG(ERROR) << "Request condition variable got wrong response from IPC channel :'" << receiveBuffer.getMessage() - << "'"; + IOX_LOG(ERROR, + "Request condition variable got wrong response from IPC channel :'" << receiveBuffer.getMessage() << "'"); return err(IpcMessageErrorType::REQUEST_CONDITION_VARIABLE_WRONG_IPC_MESSAGE_RESPONSE); } @@ -626,21 +643,21 @@ popo::ConditionVariableData* PoshRuntimeImpl::getMiddlewareConditionVariable() n switch (maybeConditionVariable.error()) { case IpcMessageErrorType::CONDITION_VARIABLE_LIST_FULL: - IOX_LOG(WARN) << "Could not create condition variable as we are out of memory for condition variables."; + IOX_LOG(WARN, "Could not create condition variable as we are out of memory for condition variables."); errorHandler(PoshError::POSH__RUNTIME_ROUDI_CONDITION_VARIABLE_LIST_FULL, iox::ErrorLevel::SEVERE); break; case IpcMessageErrorType::REQUEST_CONDITION_VARIABLE_INVALID_RESPONSE: - IOX_LOG(WARN) << "Could not create condition variables; received invalid IPC channel response."; + IOX_LOG(WARN, "Could not create condition variables; received invalid IPC channel response."); errorHandler(PoshError::POSH__RUNTIME_ROUDI_REQUEST_CONDITION_VARIABLE_INVALID_RESPONSE, iox::ErrorLevel::SEVERE); break; case IpcMessageErrorType::REQUEST_CONDITION_VARIABLE_WRONG_IPC_MESSAGE_RESPONSE: - IOX_LOG(WARN) << "Could not create condition variables; received wrong IPC channel response."; + IOX_LOG(WARN, "Could not create condition variables; received wrong IPC channel response."); errorHandler(PoshError::POSH__RUNTIME_ROUDI_REQUEST_CONDITION_VARIABLE_WRONG_IPC_MESSAGE_RESPONSE, iox::ErrorLevel::SEVERE); break; default: - IOX_LOG(WARN) << "Unknown error occurred while creating condition variable"; + IOX_LOG(WARN, "Unknown error occurred while creating condition variable"); errorHandler(PoshError::POSH__RUNTIME_ROUDI_CONDITION_VARIABLE_CREATION_UNKNOWN_ERROR, iox::ErrorLevel::SEVERE); break; @@ -662,7 +679,7 @@ void PoshRuntimeImpl::sendKeepAliveAndHandleShutdownPreparation() noexcept { if (!m_ipcChannelInterface.sendKeepalive()) { - IOX_LOG(WARN) << "Error in sending keep alive"; + IOX_LOG(WARN, "Error in sending keep alive"); } // this is not the nicest solution, but we cannot send this in the signal handler where m_shutdownRequested is @@ -683,18 +700,20 @@ void PoshRuntimeImpl::sendKeepAliveAndHandleShutdownPreparation() noexcept if (stringToIpcMessageType(IpcMessage.c_str()) == IpcMessageType::PREPARE_APP_TERMINATION_ACK) { - IOX_LOG(TRACE) << "RouDi unblocked shutdown of " << m_appName << "."; + IOX_LOG(TRACE, "RouDi unblocked shutdown of " << m_appName << "."); } else { - IOX_LOG(ERROR) << "Got wrong response from IPC channel for PREPARE_APP_TERMINATION:'" - << receiveBuffer.getMessage() << "'"; + IOX_LOG(ERROR, + "Got wrong response from IPC channel for PREPARE_APP_TERMINATION:'" + << receiveBuffer.getMessage() << "'"); } } else { - IOX_LOG(ERROR) << "Sending IpcMessageType::PREPARE_APP_TERMINATION to RouDi failed:'" - << receiveBuffer.getMessage() << "'"; + IOX_LOG(ERROR, + "Sending IpcMessageType::PREPARE_APP_TERMINATION to RouDi failed:'" << receiveBuffer.getMessage() + << "'"); } } } diff --git a/iceoryx_posh/source/runtime/posh_runtime_single_process.cpp b/iceoryx_posh/source/runtime/posh_runtime_single_process.cpp index 020f27e83b4..e4b2849b5ac 100644 --- a/iceoryx_posh/source/runtime/posh_runtime_single_process.cpp +++ b/iceoryx_posh/source/runtime/posh_runtime_single_process.cpp @@ -44,9 +44,9 @@ PoshRuntimeSingleProcess::PoshRuntimeSingleProcess(const RuntimeName_t& name) no } else { - IOX_LOG(ERROR) - << "PoshRuntimeSingleProcess can only created once per process and only if the default PoshRuntime " - "factory method is set!"; + IOX_LOG(ERROR, + "PoshRuntimeSingleProcess can only created once per process and only if the default PoshRuntime " + "factory method is set!"); errorHandler(PoshError::POSH__RUNTIME_IS_CREATED_MULTIPLE_TIMES); } } diff --git a/iceoryx_posh/source/runtime/service_discovery.cpp b/iceoryx_posh/source/runtime/service_discovery.cpp index cbf6040c51a..f0217d0ab41 100644 --- a/iceoryx_posh/source/runtime/service_discovery.cpp +++ b/iceoryx_posh/source/runtime/service_discovery.cpp @@ -68,7 +68,7 @@ void ServiceDiscovery::findService(const optional& service, } default: { - IOX_LOG(WARN) << "ServiceDiscovery could not perform search due to unknown MessagingPattern!"; + IOX_LOG(WARN, "ServiceDiscovery could not perform search due to unknown MessagingPattern!"); errorHandler(PoshError::POSH__SERVICE_DISCOVERY_UNKNOWN_MESSAGE_PATTERN_PROVIDED, ErrorLevel::MODERATE); } } @@ -85,7 +85,7 @@ void ServiceDiscovery::enableEvent(popo::TriggerHandle&& triggerHandle, const Se } default: { - IOX_LOG(WARN) << "ServiceDiscovery::enableEvent() called with unknown event!"; + IOX_LOG(WARN, "ServiceDiscovery::enableEvent() called with unknown event!"); errorHandler(PoshError::POSH__SERVICE_DISCOVERY_UNKNOWN_EVENT_PROVIDED, ErrorLevel::MODERATE); } } @@ -102,7 +102,7 @@ void ServiceDiscovery::disableEvent(const ServiceDiscoveryEvent event) noexcept } default: { - IOX_LOG(WARN) << "ServiceDiscovery::disableEvent() called with unknown event!"; + IOX_LOG(WARN, "ServiceDiscovery::disableEvent() called with unknown event!"); errorHandler(PoshError::POSH__SERVICE_DISCOVERY_UNKNOWN_EVENT_PROVIDED, ErrorLevel::MODERATE); } } diff --git a/iceoryx_posh/source/runtime/shared_memory_user.cpp b/iceoryx_posh/source/runtime/shared_memory_user.cpp index 67df49ef4ad..74a71f47494 100644 --- a/iceoryx_posh/source/runtime/shared_memory_user.cpp +++ b/iceoryx_posh/source/runtime/shared_memory_user.cpp @@ -49,10 +49,11 @@ SharedMemoryUser::SharedMemoryUser(const size_t topicSize, errorHandler(PoshError::POSH__SHM_APP_COULD_NOT_REGISTER_PTR_WITH_GIVEN_SEGMENT_ID); } - IOX_LOG(DEBUG) << "Application registered management segment " - << iox::log::hex(sharedMemoryObject.getBaseAddress()) << " with size " - << sharedMemoryObject.get_size().expect("Failed to acquire SHM size.") << " to id " - << segmentId; + IOX_LOG(DEBUG, + "Application registered management segment " + << iox::log::hex(sharedMemoryObject.getBaseAddress()) << " with size " + << sharedMemoryObject.get_size().expect("Failed to acquire SHM size.") << " to id " + << segmentId); this->openDataSegments(segmentId, segmentManagerAddressOffset); @@ -94,10 +95,11 @@ void SharedMemoryUser::openDataSegments(const uint64_t segmentId, errorHandler(PoshError::POSH__SHM_APP_COULD_NOT_REGISTER_PTR_WITH_GIVEN_SEGMENT_ID); } - IOX_LOG(DEBUG) << "Application registered payload data segment " - << iox::log::hex(sharedMemoryObject.getBaseAddress()) << " with size " - << sharedMemoryObject.get_size().expect("Failed to get SHM size.") << " to id " - << segment.m_segmentId; + IOX_LOG(DEBUG, + "Application registered payload data segment " + << iox::log::hex(sharedMemoryObject.getBaseAddress()) << " with size " + << sharedMemoryObject.get_size().expect("Failed to get SHM size.") << " to id " + << segment.m_segmentId); m_dataShmObjects.emplace_back(std::move(sharedMemoryObject)); })