#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include "rcutils/visibility_control.h"
Go to the source code of this file.
The structure identifying the caller location in the source code.
| typedef void(* rcl_logging_output_handler_t) (rcl_log_location_t *,int,const char *,const char *,va_list *) |
The function signature to log messages.
- Parameters
-
| The | pointer to the location struct |
| The | severity level |
| The | name of the logger |
| The | format string |
| The | variable argument list |
The severity levels of log message.
| Enumerator |
|---|
| RCUTILS_LOG_SEVERITY_DEBUG |
The debug log level.
|
| RCUTILS_LOG_SEVERITY_INFO |
The info log level.
|
| RCUTILS_LOG_SEVERITY_WARN |
The warn log level.
|
| RCUTILS_LOG_SEVERITY_ERROR |
The error log level.
|
| RCUTILS_LOG_SEVERITY_FATAL |
The fatal log level.
|
| void rcl_logging_initialize |
( |
| ) |
|
Initialize the logging system.
The function is called automatically when using the logging macros.
| Attribute | Adherence |
| Allocates Memory | No |
| Thread-Safe | No |
| Uses Atomics | No |
| Lock-Free | Yes |
Get the current output handler.
| Attribute | Adherence |
| Allocates Memory | No |
| Thread-Safe | No |
| Uses Atomics | No |
| Lock-Free | Yes |
- Returns
- The function pointer of the current output handler.
Set the current output handler.
| Attribute | Adherence |
| Allocates Memory | No |
| Thread-Safe | No |
| Uses Atomics | No |
| Lock-Free | Yes |
- Parameters
-
| function | The function pointer of the output handler to be used. |
| int rcl_logging_get_severity_threshold |
( |
| ) |
|
Get the global severity threshold.
| Attribute | Adherence |
| Allocates Memory | No |
| Thread-Safe | No |
| Uses Atomics | No |
| Lock-Free | Yes |
- Returns
- The severity threshold.
| void rcl_logging_set_severity_threshold |
( |
int |
severity | ) |
|
Set the global severity threshold.
| Attribute | Adherence |
| Allocates Memory | No |
| Thread-Safe | No |
| Uses Atomics | No |
| Lock-Free | Yes |
- Parameters
-
| severity | The severity threshold to be used. |
| void rcl_log |
( |
rcl_log_location_t * |
location, |
|
|
int |
severity, |
|
|
const char * |
name, |
|
|
const char * |
format, |
|
|
|
... |
|
) |
| |
Log a message.
The attributes of this function are also being influenced by the currently set output handler.
| Attribute | Adherence |
| Allocates Memory | No |
| Thread-Safe | No |
| Uses Atomics | No |
| Lock-Free | Yes |
- Parameters
-
| location | The pointer to the location struct |
| severity | The severity level |
| name | The name of the logger |
| format | The format string |
| ... | The variable arguments |
| void rcl_logging_console_output_handler |
( |
rcl_log_location_t * |
location, |
|
|
int |
severity, |
|
|
const char * |
name, |
|
|
const char * |
format, |
|
|
va_list * |
args |
|
) |
| |
The default output handler outputs log messages to the standard streams.
The messages with a severity DEBUG and INFO are written to stdout. The messages with a severity WARN, ERROR, and FATAL are written to stderr. For each message the severity and name is prepended and the location information is appended when available.
| Attribute | Adherence |
| Allocates Memory | No, for formatted messages <= 1023 characters |
| Yes, for formatted messages >= 1024 characters Thread-Safe | Yes, if the underlying *printf functions are Uses Atomics | No Lock-Free | Yes
- Parameters
-
| location | The pointer to the location struct |
| severity | The severity level |
| name | The name of the logger |
| format | The format string |
| args | The variable argument list |
| bool g_rcl_logging_initialized |
The flag if the logging system has been initialized.
The function pointer of the current output handler.
| int g_rcl_logging_severity_threshold |
The global severity threshold before calling the output handler.
The global severity threshold is being checked after the conditions when using the various logging macros.
- Parameters
-
| severity | The global severity threshold to be used. |