Skip to content

Commit

Permalink
Merge pull request #1959 from ApexAI/iox-1755-use-new-log-macros-in-a…
Browse files Browse the repository at this point in the history
…ll-places

iox-#1755 Use new log macros in all places
  • Loading branch information
elBoberido authored Apr 4, 2023
2 parents 85de9bd + 5c94847 commit 42baa2e
Show file tree
Hide file tree
Showing 67 changed files with 464 additions and 474 deletions.
17 changes: 9 additions & 8 deletions iceoryx_binding_c/source/c2cpp_enum_translation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "iceoryx_binding_c/internal/c2cpp_enum_translation.hpp"
#include "iceoryx_binding_c/error_handling/error_handling.hpp"
#include "iceoryx_binding_c/internal/c2cpp_binding.h"
#include "iox/logging.hpp"

namespace c2cpp
{
Expand Down Expand Up @@ -57,7 +58,7 @@ iox::popo::SubscriberEvent subscriberEvent(const iox_SubscriberEvent value) noex
return iox::popo::SubscriberEvent::DATA_RECEIVED;
}

LogFatal() << "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;
}
Expand All @@ -70,7 +71,7 @@ iox::popo::SubscriberState subscriberState(const iox_SubscriberState value) noex
return iox::popo::SubscriberState::HAS_DATA;
}

LogFatal() << "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;
}
Expand All @@ -83,7 +84,7 @@ iox::popo::ClientEvent clientEvent(const iox_ClientEvent value) noexcept
return iox::popo::ClientEvent::RESPONSE_RECEIVED;
}

LogFatal() << "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;
}
Expand All @@ -96,7 +97,7 @@ iox::popo::ClientState clientState(const iox_ClientState value) noexcept
return iox::popo::ClientState::HAS_RESPONSE;
}

LogFatal() << "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;
}
Expand All @@ -109,7 +110,7 @@ iox::popo::ServerEvent serverEvent(const iox_ServerEvent value) noexcept
return iox::popo::ServerEvent::REQUEST_RECEIVED;
}

LogFatal() << "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;
}
Expand All @@ -122,7 +123,7 @@ iox::popo::ServerState serverState(const iox_ServerState value) noexcept
return iox::popo::ServerState::HAS_REQUEST;
}

LogFatal() << "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;
}
Expand All @@ -135,7 +136,7 @@ iox::runtime::ServiceDiscoveryEvent serviceDiscoveryEvent(const iox_ServiceDisco
return iox::runtime::ServiceDiscoveryEvent::SERVICE_REGISTRY_CHANGED;
}

LogFatal() << "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;
}
Expand All @@ -150,7 +151,7 @@ iox::popo::MessagingPattern messagingPattern(const iox_MessagingPattern value) n
return iox::popo::MessagingPattern::REQ_RES;
}

LogFatal() << "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;
}
Expand Down
7 changes: 4 additions & 3 deletions iceoryx_binding_c/source/c_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "iceoryx_binding_c/internal/cpp2c_service_description_translation.hpp"
#include "iceoryx_posh/internal/popo/ports/publisher_port_user.hpp"
#include "iceoryx_posh/runtime/posh_runtime.hpp"
#include "iox/logging.hpp"


using namespace iox;
Expand All @@ -41,7 +42,7 @@ void iox_pub_options_init(iox_pub_options_t* options)
{
if (options == nullptr)
{
LogWarn() << "publisher options initialization skipped - null pointer provided";
IOX_LOG(WARN) << "publisher options initialization skipped - null pointer provided";
return;
}

Expand All @@ -67,7 +68,7 @@ iox_pub_t iox_pub_init(iox_pub_storage_t* self,
{
if (self == nullptr)
{
LogWarn() << "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;
}

Expand All @@ -80,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
LogFatal() << "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;
Expand Down
8 changes: 4 additions & 4 deletions iceoryx_binding_c/source/c_subscriber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
//
// SPDX-License-Identifier: Apache-2.0


#include "iceoryx_binding_c/enums.h"
#include "iceoryx_binding_c/error_handling/error_handling.hpp"
#include "iceoryx_binding_c/internal/c2cpp_enum_translation.hpp"
Expand All @@ -25,6 +24,7 @@
#include "iceoryx_posh/internal/popo/ports/subscriber_port_user.hpp"
#include "iceoryx_posh/mepoo/chunk_header.hpp"
#include "iceoryx_posh/runtime/posh_runtime.hpp"
#include "iox/logging.hpp"


using namespace iox;
Expand All @@ -51,7 +51,7 @@ void iox_sub_options_init(iox_sub_options_t* options)
{
if (options == nullptr)
{
LogWarn() << "subscriber options initialization skipped - null pointer provided";
IOX_LOG(WARN) << "subscriber options initialization skipped - null pointer provided";
return;
}

Expand Down Expand Up @@ -79,7 +79,7 @@ iox_sub_t iox_sub_init(iox_sub_storage_t* self,
{
if (self == nullptr)
{
LogWarn() << "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;
}

Expand All @@ -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
LogFatal() << "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;
Expand Down
3 changes: 2 additions & 1 deletion iceoryx_binding_c/source/c_user_trigger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "iceoryx_binding_c/internal/cpp2c_enum_translation.hpp"
#include "iceoryx_posh/popo/user_trigger.hpp"
#include "iox/logging.hpp"

using namespace iox;
using namespace iox::popo;
Expand All @@ -29,7 +30,7 @@ iox_user_trigger_t iox_user_trigger_init(iox_user_trigger_storage_t* self)
{
if (self == nullptr)
{
LogWarn() << "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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int main(int argc, char* argv[])
auto cmdLineArgs = cmdLineParser.parse(argc, argv);
if (cmdLineArgs.has_error() && (cmdLineArgs.get_error() != iox::config::CmdLineParserResult::INFO_OUTPUT_ONLY))
{
LogFatal() << "Unable to parse command line arguments!";
IOX_LOG(FATAL) << "Unable to parse command line arguments!";
return EXIT_FAILURE;
}

Expand Down
2 changes: 1 addition & 1 deletion iceoryx_examples/iceperf/roudi_main_static_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int main(int argc, char* argv[])
auto cmdLineArgs = cmdLineParser.parse(argc, argv);
if (cmdLineArgs.has_error() && (cmdLineArgs.get_error() != iox::config::CmdLineParserResult::INFO_OUTPUT_ONLY))
{
LogFatal() << "Unable to parse command line arguments!";
IOX_LOG(FATAL) << "Unable to parse command line arguments!";
return EXIT_FAILURE;
}

Expand Down
4 changes: 2 additions & 2 deletions iceoryx_posh/cmake/iceoryx_versions.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#define ICEORYX_BUILDDATE "@ICEORYX_BUILDDATE@"
#define ICEORYX_SHA1 "@ICEORYX_SHA1@"

#include "iceoryx_posh/internal/log/posh_logging.hpp"
#include "iox/logging.hpp"

#define ICEORYX_PRINT_BUILDINFO() iox::LogInfo() << "Built: " << ICEORYX_BUILDDATE;
#define ICEORYX_PRINT_BUILDINFO() IOX_LOG(INFO) << "Built: " << ICEORYX_BUILDDATE;


#endif
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "iceoryx_dust/cxx/file_reader.hpp"
#include "iceoryx_posh/gateway/gateway_generic.hpp"
#include "iceoryx_posh/internal/log/posh_logging.hpp"
#include "iox/logging.hpp"

// ================================================== Public ================================================== //

Expand Down
31 changes: 0 additions & 31 deletions iceoryx_posh/include/iceoryx_posh/internal/log/posh_logging.hpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
#define IOX_POSH_MEPOO_MEPOO_SEGMENT_INL

#include "iceoryx_posh/error_handling/error_handling.hpp"
#include "iceoryx_posh/internal/log/posh_logging.hpp"
#include "iceoryx_posh/internal/mepoo/mepoo_segment.hpp"
#include "iceoryx_posh/mepoo/memory_info.hpp"
#include "iceoryx_posh/mepoo/mepoo_config.hpp"
#include "iox/logging.hpp"
#include "iox/relative_pointer.hpp"

namespace iox
Expand Down Expand Up @@ -84,9 +84,9 @@ inline SharedMemoryObjectType MePooSegment<SharedMemoryObjectType, MemoryManager
}
this->setSegmentId(static_cast<uint64_t>(maybeSegmentId.value()));

LogDebug() << "Roudi registered payload data segment "
<< iox::log::hex(sharedMemoryObject.getBaseAddress()) << " with size "
<< sharedMemoryObject.getSizeInBytes() << " to id " << m_segmentId;
IOX_LOG(DEBUG) << "Roudi registered payload data segment "
<< iox::log::hex(sharedMemoryObject.getBaseAddress()) << " with size "
<< sharedMemoryObject.getSizeInBytes() << " to id " << m_segmentId;
})
.or_else([](auto&) { errorHandler(PoshError::MEPOO__SEGMENT_UNABLE_TO_CREATE_SHARED_MEMORY_OBJECT); })
.value());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ inline void BaseClient<PortT, TriggerHandleT>::enableState(TriggerHandleT&& trig
case ClientState::HAS_RESPONSE:
if (m_trigger)
{
LogWarn()
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.";
Expand Down Expand Up @@ -155,7 +155,7 @@ inline void BaseClient<PortT, TriggerHandleT>::enableEvent(TriggerHandleT&& trig
case ClientEvent::RESPONSE_RECEIVED:
if (m_trigger)
{
LogWarn()
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 "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ inline void BaseServer<PortT, TriggerHandleT>::enableState(TriggerHandleT&& trig
case ServerState::HAS_REQUEST:
if (m_trigger)
{
LogWarn()
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.";
Expand Down Expand Up @@ -159,7 +159,7 @@ inline void BaseServer<PortT, TriggerHandleT>::enableEvent(TriggerHandleT&& trig
case ServerEvent::REQUEST_RECEIVED:
if (m_trigger)
{
LogWarn()
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 "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ inline void BaseSubscriber<port_t>::enableState(iox::popo::TriggerHandle&& trigg
case SubscriberState::HAS_DATA:
if (m_trigger)
{
LogWarn()
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.";
Expand Down Expand Up @@ -167,7 +167,7 @@ inline void BaseSubscriber<port_t>::enableEvent(iox::popo::TriggerHandle&& trigg
case SubscriberEvent::DATA_RECEIVED:
if (m_trigger)
{
LogWarn()
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 "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ ChunkDistributor<ChunkDistributorDataType>::tryAddQueue(not_null<ChunkQueueData_

if (requestedHistory > getMembers()->m_historyCapacity)
{
LogWarn() << "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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

#include "iceoryx_hoofs/internal/posix_wrapper/mutex.hpp"
#include "iceoryx_posh/error_handling/error_handling.hpp"
#include "iceoryx_posh/internal/log/posh_logging.hpp"
#include "iceoryx_posh/internal/mepoo/shm_safe_unmanaged_chunk.hpp"
#include "iceoryx_posh/internal/popo/building_blocks/chunk_queue_pusher.hpp"
#include "iceoryx_posh/popo/port_queue_policies.hpp"
#include "iox/algorithm.hpp"
#include "iox/logging.hpp"
#include "iox/relative_pointer.hpp"
#include "iox/vector.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ inline ChunkDistributorData<ChunkDistributorDataProperties, LockingPolicy, Chunk
{
if (m_historyCapacity != historyCapacity)
{
LogWarn() << "Chunk history too large, reducing from " << historyCapacity << " to " << m_historyCapacity;
IOX_LOG(WARN) << "Chunk history too large, reducing from " << historyCapacity << " to " << m_historyCapacity;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#ifndef IOX_POSH_POPO_BUILDING_BLOCKS_CHUNK_QUEUE_POPPER_INL
#define IOX_POSH_POPO_BUILDING_BLOCKS_CHUNK_QUEUE_POPPER_INL

#include "iceoryx_posh/internal/log/posh_logging.hpp"
#include "iceoryx_posh/internal/popo/building_blocks/chunk_queue_popper.hpp"
#include "iox/logging.hpp"

namespace iox
{
Expand Down Expand Up @@ -57,8 +57,8 @@ inline optional<mepoo::SharedChunk> ChunkQueuePopper<ChunkQueueDataType>::tryPop
auto receivedChunkHeaderVersion = chunk.getChunkHeader()->chunkHeaderVersion();
if (receivedChunkHeaderVersion != mepoo::ChunkHeader::CHUNK_HEADER_VERSION)
{
LogError() << "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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ inline expected<ClientSendError> Request<T>::send() noexcept
}
else
{
LogError() << "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 error<ClientSendError>(ClientSendError::INVALID_REQUEST);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ inline expected<ServerSendError> Response<T>::send() noexcept
}
else
{
LogError() << "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 error<ServerSendError>(ServerSendError::INVALID_RESPONSE);
}
Expand Down
Loading

0 comments on commit 42baa2e

Please sign in to comment.