rcl  master
C API providing common ROS client library functionality.
Classes | Typedefs | Functions
log_level.h File Reference
#include "rcl/allocator.h"
#include "rcl/macros.h"
#include "rcl/types.h"
#include "rcl/visibility_control.h"
Include dependency graph for log_level.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  rcl_logger_setting_t
 A logger item to specify a name and a log level. More...
 
struct  rcl_log_levels_t
 Hold default logger level and other logger setting. More...
 

Typedefs

typedef enum RCUTILS_LOG_SEVERITY rcl_log_severity_t
 typedef for RCUTILS_LOG_SEVERITY;
 
typedef struct rcl_logger_setting_t rcl_logger_setting_t
 A logger item to specify a name and a log level.
 
typedef struct rcl_log_levels_t rcl_log_levels_t
 Hold default logger level and other logger setting.
 

Functions

rcl_log_levels_t rcl_get_zero_initialized_log_levels ()
 Return a rcl_log_levels_t struct with members initialized to zero value. More...
 
rcl_ret_t rcl_log_levels_init (rcl_log_levels_t *log_levels, const rcl_allocator_t *allocator, size_t logger_count)
 Initialize a log levels structure. More...
 
rcl_ret_t rcl_log_levels_copy (const rcl_log_levels_t *src, rcl_log_levels_t *dst)
 Copy one log levels structure into another. More...
 
rcl_ret_t rcl_log_levels_fini (rcl_log_levels_t *log_levels)
 Reclaim resources held inside rcl_log_levels_t structure. More...
 
rcl_ret_t rcl_log_levels_shrink_to_size (rcl_log_levels_t *log_levels)
 Shrink log levels structure. More...
 
rcl_ret_t rcl_log_levels_add_logger_setting (rcl_log_levels_t *log_levels, const char *logger_name, rcl_log_severity_t log_level)
 Add logger setting with a name and a level. More...
 

Function Documentation

◆ rcl_get_zero_initialized_log_levels()

rcl_log_levels_t rcl_get_zero_initialized_log_levels ( )

Return a rcl_log_levels_t struct with members initialized to zero value.


Attribute Adherence
Allocates Memory No
Thread-Safe Yes
Uses Atomics No
Lock-Free Yes
Returns
a rcl_log_levels_t struct with members initialized to zero value.

◆ rcl_log_levels_init()

rcl_ret_t rcl_log_levels_init ( rcl_log_levels_t log_levels,
const rcl_allocator_t allocator,
size_t  logger_count 
)

Initialize a log levels structure.


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes
Parameters
[in]log_levelsThe structure to be initialized.
[in]allocatorMemory allocator to be used and assigned into log_levels.
[in]logger_countNumber of logger settings to be allocated. This reserves memory for logger_settings, but doesn't initialize it.
Returns
RCL_RET_OK if the structure was initialized successfully, or
RCL_RET_INVALID_ARGUMENT if log_levels is NULL, or
RCL_RET_INVALID_ARGUMENT if log_levels contains initialized memory, or
RCL_RET_INVALID_ARGUMENT if allocator is invalid, or
RCL_RET_BAD_ALLOC if allocating memory failed.

◆ rcl_log_levels_copy()

rcl_ret_t rcl_log_levels_copy ( const rcl_log_levels_t src,
rcl_log_levels_t dst 
)

Copy one log levels structure into another.


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes
Parameters
[in]srcThe structure to be copied. Its allocator is used to copy memory into the new structure.
[out]dstA log levels structure to be copied into.
Returns
RCL_RET_OK if the structure was copied successfully, or
RCL_RET_INVALID_ARGUMENT if src is NULL, or
RCL_RET_INVALID_ARGUMENT if src allocator is invalid, or
RCL_RET_INVALID_ARGUMENT if dst is NULL, or
RCL_RET_INVALID_ARGUMENT if dst contains already allocated memory, or
RCL_RET_BAD_ALLOC if allocating memory failed.

◆ rcl_log_levels_fini()

rcl_ret_t rcl_log_levels_fini ( rcl_log_levels_t log_levels)

Reclaim resources held inside rcl_log_levels_t structure.


Attribute Adherence
Allocates Memory No
Thread-Safe No
Uses Atomics No
Lock-Free Yes
Parameters
[in]log_levelsThe structure which its resources have to be deallocated.
Returns
RCL_RET_OK if the memory was successfully freed, or
RCL_RET_INVALID_ARGUMENT if log_levels is NULL, or
RCL_RET_INVALID_ARGUMENT if the log_levels allocator is invalid and the structure contains initialized memory.

◆ rcl_log_levels_shrink_to_size()

rcl_ret_t rcl_log_levels_shrink_to_size ( rcl_log_levels_t log_levels)

Shrink log levels structure.


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes
Parameters
[in]log_levelsThe structure to be shrunk.
Returns
RCL_RET_OK if the memory was successfully shrunk, or
RCL_RET_INVALID_ARGUMENT if log_levels is NULL or if its allocator is invalid, or
RCL_RET_BAD_ALLOC if reallocating memory failed.

◆ rcl_log_levels_add_logger_setting()

rcl_ret_t rcl_log_levels_add_logger_setting ( rcl_log_levels_t log_levels,
const char *  logger_name,
rcl_log_severity_t  log_level 
)

Add logger setting with a name and a level.


Attribute Adherence
Allocates Memory Yes
Thread-Safe No
Uses Atomics No
Lock-Free Yes
Parameters
[in]log_levelsThe structure where to set the logger log level.
[in]logger_nameName for the logger, a copy of it will be stored in the structure.
[in]log_levelMinimum log level severity to be set for logger_name.
Returns
RCL_RET_OK if add logger setting successfully, or
RCL_RET_BAD_ALLOC if allocating memory failed, or
RCL_RET_INVALID_ARGUMENT if log_levels is NULL, or
RCL_RET_INVALID_ARGUMENT if log_levels was not initialized, or
RCL_RET_INVALID_ARGUMENT if log_levels allocator is invalid, or
RCL_RET_INVALID_ARGUMENT if logger_name is NULL, or
RCL_RET_ERROR if the log_levels structure is already full.