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

Enabled Logger based on Severity #2384

Open
wants to merge 5 commits into
base: rolling
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rclcpp/include/rclcpp/logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "rcl/node.h"
#include "rcutils/logging.h"
#include "rcpputils/filesystem_helper.hpp"
#include "rclcpp/logging.hpp"

/**
* \def RCLCPP_LOGGING_ENABLED
Expand All @@ -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
Copy link
Collaborator

@Barry-Xu-2018 Barry-Xu-2018 Dec 11, 2023

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

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?

#define RCLCPP_LOGGING_ENABLED 1
#endif

Expand Down