Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[config] Adding config object to logging #1704

Closed
wants to merge 22 commits into from

Conversation

Peguen
Copy link
Contributor

@Peguen Peguen commented Aug 9, 2024

Description

tbd

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

attr.broadcast = UDP::IsBroadcast();
attr.loopback = true;
attr.sndbuf = UDP::GetSendBufferSize();
eCAL::UDP::SSenderAttr attr = UDP::CreateUDPSenderAttr(GetConfiguration().registration, GetConfiguration().transport_layer.udp);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'attr' of type 'eCAL::UDP::SSenderAttr' can be declared 'const' [misc-const-correctness]

Suggested change
eCAL::UDP::SSenderAttr attr = UDP::CreateUDPSenderAttr(GetConfiguration().registration, GetConfiguration().transport_layer.udp);
eCAL::UDP::SSenderAttr const attr = UDP::CreateUDPSenderAttr(GetConfiguration().registration, GetConfiguration().transport_layer.udp);

attr.broadcast = UDP::IsBroadcast();
attr.loopback = true;
attr.rcvbuf = UDP::GetReceiveBufferSize();
eCAL::UDP::SReceiverAttr attr = UDP::CreateUDPReceiverAttr(GetConfiguration().registration, GetConfiguration().transport_layer.udp);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'attr' of type 'eCAL::UDP::SReceiverAttr' can be declared 'const' [misc-const-correctness]

Suggested change
eCAL::UDP::SReceiverAttr attr = UDP::CreateUDPReceiverAttr(GetConfiguration().registration, GetConfiguration().transport_layer.udp);
eCAL::UDP::SReceiverAttr const attr = UDP::CreateUDPReceiverAttr(GetConfiguration().registration, GetConfiguration().transport_layer.udp);

@Peguen Peguen added the cherry-pick-to-NONE Don't cherry-pick these changes label Aug 12, 2024
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

const std::string tstring = get_time_str();

m_logfile_name = ecal_log_path + tstring + "_" + eCAL::Process::GetUnitName() + "_" + std::to_string(m_pid) + ".log";
m_logfile = fopen(m_logfile_name.c_str(), "w");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: assigning newly created 'gsl::owner<>' to non-owner 'FILE *' (aka '_IO_FILE *') [cppcoreguidelines-owning-memory]

        m_logfile = fopen(m_logfile_name.c_str(), "w");
        ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 20 out of 38. Check the log or trigger a new build to see more.


for (const auto& registration_sample : expired_samples)
{
Sample unregistration_sample = CreateUnregisterSample(registration_sample.second);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'unregistration_sample' of type 'Sample' can be declared 'const' [misc-const-correctness]

Suggested change
Sample unregistration_sample = CreateUnregisterSample(registration_sample.second);
Sample const unregistration_sample = CreateUnregisterSample(registration_sample.second);

};

// Transport layer parameters for ecal udp multicast
struct LayerParUdpMC
{
bool operator==(const LayerParUdpMC& other) const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: parameter 'other' is unused [misc-unused-parameters]

Suggested change
bool operator==(const LayerParUdpMC& other) const {
bool operator==(const LayerParUdpMC& /*other*/) const {

@@ -40,6 +40,13 @@ namespace
return reg_sample;
}

eCAL::Registration::Sample DestroyPublisher(const std::string& topic_name_, std::uint64_t topic_id_)
{
eCAL::Registration::Sample reg_sample = CreatePublisher(topic_name_, topic_id_);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'reg_sample' is not initialized [cppcoreguidelines-init-variables]

Suggested change
eCAL::Registration::Sample reg_sample = CreatePublisher(topic_name_, topic_id_);
eCAL::Registration::Sample reg_sample = 0 = CreatePublisher(topic_name_, topic_id_);

@@ -52,6 +59,13 @@
return reg_sample;
}

eCAL::Registration::Sample DestroySubscriber(const std::string& topic_name_, std::uint64_t topic_id_)
{
eCAL::Registration::Sample reg_sample = CreateSubscriber(topic_name_, topic_id_);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'reg_sample' is not initialized [cppcoreguidelines-init-variables]

Suggested change
eCAL::Registration::Sample reg_sample = CreateSubscriber(topic_name_, topic_id_);
eCAL::Registration::Sample reg_sample = 0 = CreateSubscriber(topic_name_, topic_id_);

@@ -65,6 +79,13 @@
return reg_sample;
}

eCAL::Registration::Sample DestroyService(const std::string& service_name_, std::uint64_t service_id_)
{
eCAL::Registration::Sample reg_sample = CreateService(service_name_, service_id_);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'reg_sample' is not initialized [cppcoreguidelines-init-variables]

Suggested change
eCAL::Registration::Sample reg_sample = CreateService(service_name_, service_id_);
eCAL::Registration::Sample reg_sample = 0 = CreateService(service_name_, service_id_);


// sample should be expired
EXPECT_EQ(0, desc_gate.GetClients().size());
}

TEST(core_cpp_descgate, ManyClient)
{
eCAL::CDescGate desc_gate(std::chrono::milliseconds(DESCGATE_EXPIRATION_MS));
eCAL::CDescGate desc_gate;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'desc_gate' is not initialized [cppcoreguidelines-init-variables]

Suggested change
eCAL::CDescGate desc_gate;
eCAL::CDescGate desc_gate = 0;

// sleep
TestingClock::increment_time(std::chrono::milliseconds(150));
}

TEST(core_cpp_core, ExpMap_EraseMultiple)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: all parameters should be named in a function [readability-named-parameter]

Suggested change
TEST(core_cpp_core, ExpMap_EraseMultiple)
TEST(core_cpp_core /*unused*/, ExpMap_EraseMultiple /*unused*/)


#include <chrono>

#include <gtest/gtest.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'gtest/gtest.h' file not found [clang-diagnostic-error]

#include <gtest/gtest.h>
         ^

#include "registration/ecal_registration_timeout_provider.h"
#include "serialization/ecal_struct_sample_registration.h"

eCAL::Registration::Sample pub_foo_process_a_unregister;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'pub_foo_process_a_unregister' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

eCAL::Registration::Sample pub_foo_process_a_unregister;
                           ^

#include "serialization/ecal_struct_sample_registration.h"

eCAL::Registration::Sample pub_foo_process_a_unregister;
eCAL::Registration::Sample pub_foo_process_a_register_1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'pub_foo_process_a_register_1' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

eCAL::Registration::Sample pub_foo_process_a_register_1;
                           ^

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

#include <ecal/ecal_log.h>
#include <ecal/ecal_log_level.h>

#include <gtest/gtest.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'gtest/gtest.h' file not found [clang-diagnostic-error]

#include <gtest/gtest.h>
         ^


eCAL::Logging::Log(log_message);

std::string filepath;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'filepath' of type 'std::string' (aka 'basic_string') can be declared 'const' [misc-const-correctness]

Suggested change
std::string filepath;
std::string const filepath;

@Peguen
Copy link
Contributor Author

Peguen commented Aug 28, 2024

Closed because of problems after merged master. Using #1724 instead.

@Peguen Peguen closed this Aug 28, 2024
@Peguen Peguen deleted the feature/logging_configuration branch August 28, 2024 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-to-NONE Don't cherry-pick these changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant