rcl  master
C API providing common ROS client library functionality.
Functions
logging_external_interface.h File Reference
#include "rcl/macros.h"
#include "rcl/types.h"
#include "rcl/visibility_control.h"
Include dependency graph for logging_external_interface.h:

Go to the source code of this file.

Functions

rcl_ret_t rcl_logging_external_initialize (const char *config_file, rcutils_allocator_t allocator)
 Initialize the external logging library. More...
 
rcl_ret_t rcl_logging_external_shutdown ()
 Free the resources allocated for the external logging system. More...
 
void rcl_logging_external_log (int severity, const char *name, const char *msg)
 Log a message. More...
 
rcl_ret_t rcl_logging_external_set_logger_level (const char *name, int level)
 Set the severity level for a logger. More...
 

Function Documentation

◆ rcl_logging_external_initialize()

rcl_ret_t rcl_logging_external_initialize ( const char *  config_file,
rcutils_allocator_t  allocator 
)

Initialize the external logging library.

Parameters
[in]config_fileThe location of a config file that the external logging library should use to configure itself. If no config file is provided this will be set to an empty string. Must be a NULL terminated c string.
[in]allocatorThe allocator to use for memory allocation. This is an rcutils_allocator_t rather than an rcl_allocator_t to ensure that the rcl_logging_* packages don't have a circular dependency back to rcl.
Todo:
TODO(clalancette) This API is marked RCL_PUBLIC, but is not built or exported from librcl. Instead, these headers should be split into a separate package which is then depended on by both rcl and the rcl_logging_* implementations. The duplicated headers from the implementations could then be removed.
Returns
RCL_RET_OK if initialized successfully, or
RCL_RET_ERROR if an unspecified error occurs.

◆ rcl_logging_external_shutdown()

rcl_ret_t rcl_logging_external_shutdown ( )

Free the resources allocated for the external logging system.

This puts the system into a state equivalent to being uninitialized.

Returns
RCL_RET_OK if successfully shutdown, or
RCL_RET_ERROR if an unspecified error occurs.

◆ rcl_logging_external_log()

void rcl_logging_external_log ( int  severity,
const char *  name,
const char *  msg 
)

Log a message.

Parameters
[in]severityThe severity level of the message being logged.
[in]nameThe name of the logger, must either be a null terminated c string or NULL. If NULL or empty the root logger will be used.
[in]msgThe message to be logged. Must be a null terminated c string.

◆ rcl_logging_external_set_logger_level()

rcl_ret_t rcl_logging_external_set_logger_level ( const char *  name,
int  level 
)

Set the severity level for a logger.

This function sets the severity level for the specified logger. If the name provided is an empty string or NULL it will change the level of the root logger.

Parameters
[in]nameThe name of the logger. Must be a NULL terminated c string or NULL.
[in]levelThe severity level to be used for the specified logger.
Returns
RCL_RET_OK if set successfully, or
RCL_RET_ERROR if an unspecified error occurs.