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

use parent logger #921

Merged
merged 15 commits into from
Feb 22, 2023
63 changes: 63 additions & 0 deletions rcl/include/rcl/logging_rosout.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,69 @@ rcl_logging_rosout_output_handler(
const char * format,
va_list * args);

/// Add a subordinate logger based on a logger
/**
* Calling this will use the existing publisher of `logger_name` on a node to create an subordinate
* logger that will be used by the logging system to publish all log messages from that Node's
* logger.
*
* If a subordinate logger already exists, it will NOT be created.
*
* It is expected that after creating a subordinate logger with this function
* rcl_logging_rosout_remove_sublogger() will be called for the node to cleanup
* the subordinate logger while the publisher of `logger_name` is still valid.
*
*
* <hr>
* Attribute | Adherence
* ------------------ | -------------
* Allocates Memory | Yes
* Thread-Safe | No
* Uses Atomics | No
* Lock-Free | Yes
*
* \param[in] logger_name a logger_name that has a corresponding rosout publisher on a node
* \param[in] sublogger_name a sublogger name
* \return #RCL_RET_OK if the subordinate logger was created successfully, or
* \return #RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
* \return #RCL_RET_SUBLOGGER_ALREADY_EXIST if the subordinate logger already exists, or
* \return #RCL_RET_BAD_ALLOC if allocating memory failed, or
* \return #RCL_RET_ERROR if an unspecified error occurs.
*/
fujitatomoya marked this conversation as resolved.
Show resolved Hide resolved
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_logging_rosout_add_sublogger(
const char * logger_name, const char * sublogger_name);

/// Remove a subordinate logger and cleans up allocated resources
/**
* Calling this will destroy the subordinate logger based on
* `logger_name+RCUTILS_LOGGING_SEPARATOR_STRING+sublogger_name` on that node and remove it from
* the logging system so that no more Log messages are published to this function.
*
*
* <hr>
* Attribute | Adherence
* ------------------ | -------------
* Allocates Memory | Yes
* Thread-Safe | No
* Uses Atomics | No
* Lock-Free | Yes
*
* \param[in] logger_name a logger_name that has a corresponding rosout publisher on a node
* \param[in] sublogger_name a sublogger name
* \return #RCL_RET_OK if the subordinate logger was finalized successfully, or
* \return #RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
* \return #RCL_RET_BAD_ALLOC if allocating memory failed, or
* \return #RCL_RET_ERROR if an unspecified error occurs.
*/
RCL_PUBLIC
RCL_WARN_UNUSED
rcl_ret_t
rcl_logging_rosout_remove_sublogger(
const char * logger_name, const char * sublogger_name);

#ifdef __cplusplus
}
#endif
Expand Down
Loading