-
Notifications
You must be signed in to change notification settings - Fork 413
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
Enabled Logger based on Severity #2384
base: rolling
Are you sure you want to change the base?
Conversation
Signed-off-by: CursedRock17 <[email protected]>
rclcpp/include/rclcpp/logger.hpp
Outdated
@@ -34,8 +35,7 @@ | |||
* This should be used in combination with `RCLCPP_LOG_MIN_SEVERITY` to compile | |||
* out logging macros. | |||
*/ | |||
// TODO(dhood): determine this automatically from `RCLCPP_LOG_MIN_SEVERITY` | |||
#ifndef RCLCPP_LOGGING_ENABLED | |||
#ifdef RCLCPP_LOGG_MIN_SEVERITY_NONE |
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.
typo
RCLCPP_LOGG_MIN_SEVERITY_NONE -> RCLCPP_LOG_MIN_SEVERITY_NONE
RCLCPP_LOGG_MIN_SEVERITY_NONE means compile out all macros
.
Is it correct to use this macro?
Maybe
#if RCLCPP_LOG_MIN_SEVERITY != RCLCPP_LOG_MIN_SEVERITY_NONE
#define RCLCPP_LOGGING_ENABLED 1
#endif
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.
That sounds more correct, I'll change that up soon.
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.
Should we set LOGGING_ENABLED to 1 based on any other LOG_MIN_SEVERITY?
Signed-off-by: CursedRock17 <[email protected]>
Signed-off-by: CursedRock17 <[email protected]>
Signed-off-by: CursedRock17 <[email protected]>
Signed-off-by: CursedRock17 <[email protected]>
After the rebuilt CI it seems to have no problems |
So the user is expected to specify i do not think this does not work anymore as expected (7 years ago, i wasn't here...) with current implementation of for example, if user application has something like this? // pseudo code
rclcpp::Logger logger = rclcpp::get_logger("user_logger");
logger.set_level(rclcpp::Logger::Level::Debug); // generate RCLError exception if RCLCPP_LOGGING_ENABLED is 0
RCLCPP_DEBUG(logger, "message %s", "debug");
rclcpp::Logger::Level level = logger.get_effective_level(); // generate RCLInvalidArgument exception if RCLCPP_LOGGING_ENABLED is 0 originally, i believe that this |
I can't seem to follow your train of thought all the way here, I would assume that we would want to throw an exception if Apart from where we should check for |
@CursedRock17 sorry for the confusion, let me try to rephrase it. for user experience, with #2384 (comment) sample code.
i may be missing something, but it looks like originally this |
Oh, you're saying we don't want the
As I assumed that needed to be handled at compile time. So, should we scrap what's already done in the PR, or should we just extend to these certain methods? |
yeah, that is what i thought of this
i think adding null operation for |
Originally added in pull request #411 there is the following TODO:
referencing the enabled of normal loggers. This pull request is meant to solve that TODO, or at least get a grasp on what determining loggers based on severity should look like. This could be useful for giving the user more control over how loggers turn to dummies based on the extent of failure.