-
Notifications
You must be signed in to change notification settings - Fork 2
Add simple header-only logger with macros #13
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
Add simple header-only logger with macros #13
Conversation
498b1bb to
569777c
Compare
569777c to
615ff15
Compare
There was a problem hiding this 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)
There was a problem hiding this 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)
There was a problem hiding this 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)
There was a problem hiding this 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)
There was a problem hiding this 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)
There was a problem hiding this 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)
There was a problem hiding this 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)
There was a problem hiding this 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)
There was a problem hiding this 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)
There was a problem hiding this 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)
615ff15 to
0ce3370
Compare
EddyTheCo
left a comment
There was a problem hiding this 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.
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. |
|
Will be nice if an issue is opened describing why this change/enhancement is needed. |
0ce3370 to
922c83c
Compare
Introduce log.hpp for enable or disable logging at runtime with the specif macro. Signed-off-by: Margherita Milani <margherita.milani@amarulasolutions.com>
922c83c to
c53346d
Compare
EddyTheCo
left a comment
There was a problem hiding this 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.
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. |
Introduce log.hpp for enable or disable logging at
runtime with the specif macro.