Skip to content

Commit

Permalink
improved logging
Browse files Browse the repository at this point in the history
  • Loading branch information
rex-schilasky committed Dec 11, 2024
1 parent f59b100 commit a5fb463
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions ecal/core/src/service/ecal_service_server_v5_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@ namespace eCAL
CServiceServerImpl::CServiceServerImpl()
: m_service_server_impl(nullptr)
{
Logging::Log(log_level_debug2, "Initializing default service server implementation.");
Logging::Log(log_level_debug2, "v5::CServiceServerImpl: Initializing default service server implementation.");
}

CServiceServerImpl::CServiceServerImpl(const std::string& service_name_)
: m_service_server_impl(nullptr)
{
Logging::Log(log_level_debug2, "Initializing service server with name: " + service_name_);
Logging::Log(log_level_debug2, "v5::CServiceServerImpl: Initializing service server with name: " + service_name_);
Create(service_name_);
}

CServiceServerImpl::~CServiceServerImpl()
{
Logging::Log(log_level_debug2, "Destroying service server implementation.");
Logging::Log(log_level_debug2, "v5::CServiceServerImpl: Destroying service server implementation.");
Destroy();
}

bool CServiceServerImpl::Create(const std::string& service_name_)
{
if (m_service_server_impl)
{
Logging::Log(log_level_warning, "Service server already created: " + service_name_);
Logging::Log(log_level_warning, "v5::CServiceServerImpl: Service server already created: " + service_name_);
return false;
}

Expand All @@ -72,30 +72,30 @@ namespace eCAL
};

m_service_server_impl = std::make_shared<eCAL::CServiceServer>(service_name_, event_callback);
Logging::Log(log_level_debug1, "Service server created with name: " + service_name_);
Logging::Log(log_level_debug1, "v5::CServiceServerImpl: Service server created with name: " + service_name_);
return true;
}

bool CServiceServerImpl::Destroy()
{
if (!m_service_server_impl)
{
Logging::Log(log_level_warning, "Service server not initialized, cannot destroy.");
Logging::Log(log_level_warning, "v5::CServiceServerImpl: Service server not initialized, cannot destroy.");
return false;
}

m_service_server_impl.reset();
Logging::Log(log_level_debug2, "Service server destroyed.");
Logging::Log(log_level_debug2, "v5::CServiceServerImpl: Service server destroyed.");
return true;
}

bool CServiceServerImpl::AddDescription(const std::string& method_, const std::string& req_type_, const std::string& req_desc_, const std::string& resp_type_, const std::string& resp_desc_)
{
Logging::Log(log_level_debug1, "Adding description for method: " + method_);
Logging::Log(log_level_debug1, "v5::CServiceServerImpl: Adding description for method: " + method_);

if (!m_service_server_impl)
{
Logging::Log(log_level_error, "Service server not initialized, cannot add description.");
Logging::Log(log_level_error, "v5::CServiceServerImpl: Service server not initialized, cannot add description.");
return false;
}

Expand All @@ -110,11 +110,11 @@ namespace eCAL

bool CServiceServerImpl::AddMethodCallback(const std::string& method_, const std::string& req_type_, const std::string& resp_type_, const MethodCallbackT& callback_)
{
Logging::Log(log_level_debug2, "Adding method callback for method: " + method_);
Logging::Log(log_level_debug2, "v5::CServiceServerImpl: Adding method callback for method: " + method_);

if (!m_service_server_impl)
{
Logging::Log(log_level_error, "Service server not initialized, cannot add method callback.");
Logging::Log(log_level_error, "v5::CServiceServerImpl: Service server not initialized, cannot add method callback.");
return false;
}

Expand All @@ -127,11 +127,11 @@ namespace eCAL

bool CServiceServerImpl::RemMethodCallback(const std::string& method_)
{
Logging::Log(log_level_debug2, "Removing method callback for method: " + method_);
Logging::Log(log_level_debug2, "v5::CServiceServerImpl: Removing method callback for method: " + method_);

if (!m_service_server_impl)
{
Logging::Log(log_level_error, "Service server not initialized, cannot remove method callback.");
Logging::Log(log_level_error, "v5::CServiceServerImpl: Service server not initialized, cannot remove method callback.");
return false;
}

Expand All @@ -142,10 +142,10 @@ namespace eCAL
{
if (!m_service_server_impl)
{
Logging::Log(log_level_error, "Service server not initialized, cannot add event callback.");
Logging::Log(log_level_error, "v5::CServiceServerImpl: Service server not initialized, cannot add event callback.");
return false;
}
Logging::Log(log_level_debug2, "Adding event callback for event type: " + std::to_string(type_));
Logging::Log(log_level_debug2, "v5::CServiceServerImpl: Adding event callback for event type: " + std::to_string(type_));

{
const std::lock_guard<std::mutex> lock(m_event_callback_map_mutex);
Expand All @@ -159,10 +159,10 @@ namespace eCAL
{
if (!m_service_server_impl)
{
Logging::Log(log_level_error, "Service server not initialized, cannot remove event callback.");
Logging::Log(log_level_error, "v5::CServiceServerImpl: Service server not initialized, cannot remove event callback.");
return false;
}
Logging::Log(log_level_debug2, "Removing event callback for event type: " + std::to_string(type_));
Logging::Log(log_level_debug2, "v5::CServiceServerImpl: Removing event callback for event type: " + std::to_string(type_));

{
const std::lock_guard<std::mutex> lock(m_event_callback_map_mutex);
Expand All @@ -176,7 +176,7 @@ namespace eCAL
{
if (!m_service_server_impl)
{
Logging::Log(log_level_error, "Service server not initialized, cannot get service name.");
Logging::Log(log_level_error, "v5::CServiceServerImpl: Service server not initialized, cannot get service name.");
return "";
}

Expand All @@ -187,7 +187,7 @@ namespace eCAL
{
if (!m_service_server_impl)
{
Logging::Log(log_level_error, "Service server not initialized, cannot check connection status.");
Logging::Log(log_level_error, "v5::CServiceServerImpl: Service server not initialized, cannot check connection status.");
return false;
}

Expand Down

0 comments on commit a5fb463

Please sign in to comment.