Skip to content

Conversation

@margheritamilani
Copy link
Contributor

@margheritamilani margheritamilani commented Oct 6, 2025

Introduce log.hpp for enable or disable logging at
runtime with the specif macro.

@margheritamilani margheritamilani force-pushed the feature-logging-wrapper branch from 498b1bb to 569777c Compare October 6, 2025 14:11
@margheritamilani margheritamilani force-pushed the feature-logging-wrapper branch from 569777c to 615ff15 Compare October 6, 2025 15:16
Copy link

@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 found issue(s) with the introduced code (1/10)

Copy link

@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 found issue(s) with the introduced code (2/10)

Copy link

@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 found issue(s) with the introduced code (3/10)

Copy link

@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 found issue(s) with the introduced code (4/10)

Copy link

@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 found issue(s) with the introduced code (5/10)

Copy link

@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 found issue(s) with the introduced code (6/10)

Copy link

@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 found issue(s) with the introduced code (7/10)

Copy link

@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 found issue(s) with the introduced code (8/10)

Copy link

@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 found issue(s) with the introduced code (9/10)

Copy link

@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 found issue(s) with the introduced code (10/10)

Copy link
Contributor

@EddyTheCo EddyTheCo left a comment

Choose a reason for hiding this comment

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

The class Log is very simple it only allows to enable/disable logs at runtime.
Enabling/disabling the logs at runtime it is mostly done by reading a config file or in the main function.
The class is publicly visible in the API and LCM_LOG only use one standard output stream(cerr,cout,clog...).

In my opinion if what we want is a simple turn on,off of the logs I will go for enabling/disabling the logs at compile time.
The consumer of the library can decide if enabling the logs by setting a CMake variable.
This variable can be set before doing FetchContent_MakeAvailable(GDbusCpp) so consumers can easily change if they want to see the logs of this project libraries.
The logs can be turned on in the development package but turned off in the runtime package.
I would try to separate the logs by standard output stream.

@AndreaRicchi
Copy link

The class Log is very simple it only allows to enable/disable logs at runtime. Enabling/disabling the logs at runtime it is mostly done by reading a config file or in the main function. The class is publicly visible in the API and LCM_LOG only use one standard output stream(cerr,cout,clog...).

In my opinion if what we want is a simple turn on,off of the logs I will go for enabling/disabling the logs at compile time. The consumer of the library can decide if enabling the logs by setting a CMake variable. This variable can be set before doing FetchContent_MakeAvailable(GDbusCpp) so consumers can easily change if they want to see the logs of this project libraries. The logs can be turned on in the development package but turned off in the runtime package. I would try to separate the logs by standard output stream.

No, @EddyTheCo, we cannot force the user to recompile the entire library to see logs. The idea is correct; it involves simple logging that can be enabled at runtime.

@EddyTheCo
Copy link
Contributor

Will be nice if an issue is opened describing why this change/enhancement is needed.

Introduce log.hpp for enable or disable logging at
runtime with the specif macro.

Signed-off-by: Margherita Milani <margherita.milani@amarulasolutions.com>
Copy link
Contributor

@EddyTheCo EddyTheCo left a comment

Choose a reason for hiding this comment

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

From the code part it looks good to me.
I do not know the reason why this change is needed nor there is an issue explaining it.

In my opinion creating a log class to activate/deactivate the logs for a single library at runtime introduce much logic to the library that is not needed nor is the purpose of this repo/library.

An Amarula::Log class and library should be created and linked to this library or for simplicity enable/disable logs at compile time for this library.

@EddyTheCo EddyTheCo self-requested a review October 13, 2025 09:58
@AndreaRicchi
Copy link

From the code part it looks good to me. I do not know the reason why this change is needed nor there is an issue explaining it.

In my opinion creating a log class to activate/deactivate the logs for a single library at runtime introduce much logic to the library that is not needed nor is the purpose of this repo/library.

An Amarula::Log class and library should be created and linked to this library or for simplicity enable/disable logs at compile time for this library.

This is needed because we cannot force the user to have prints that his not requesting. Since there is no need for logging level or more complex logic at the moment, this is a simple way to disable/enable prints. And again, we cannot force the user to recompile the library every time to enable or disable the logs.

@AndreaRicchi AndreaRicchi merged commit 09147c6 into amarula:main Oct 14, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants