The nrf_log control interface. More...
Macros |
|
| #define | NRF_LOG_INIT (...) NRF_LOG_INTERNAL_INIT(__VA_ARGS__) |
|
Macro for initializing the logs.
More...
|
|
| #define | NRF_LOG_PROCESS () NRF_LOG_INTERNAL_PROCESS() |
|
Macro for processing a single log entry from a queue of deferred logs.
More...
|
|
| #define | NRF_LOG_FLUSH () NRF_LOG_INTERNAL_FLUSH() |
|
Macro for processing all log entries from the buffer. It blocks until all buffered entries are processed by the backend.
More...
|
|
| #define | NRF_LOG_FINAL_FLUSH () NRF_LOG_INTERNAL_FINAL_FLUSH() |
|
Macro for flushing log data before reset.
More...
|
|
Typedefs |
|
| typedef uint32_t(* | nrf_log_timestamp_func_t )(void) |
|
Timestamp function prototype.
More...
|
|
Functions |
|
| ret_code_t | nrf_log_init ( nrf_log_timestamp_func_t timestamp_func, uint32_t timestamp_freq) |
|
Function for initializing the frontend and the default backend.
More...
|
|
| int32_t | nrf_log_backend_add ( nrf_log_backend_t *p_backend, nrf_log_severity_t severity) |
|
Function for adding new backend interface to the logger.
More...
|
|
| void | nrf_log_backend_remove ( nrf_log_backend_t *p_backend) |
|
Function for removing backend from the logger.
More...
|
|
| void | nrf_log_panic (void) |
|
Function for setting logger backends into panic mode.
More...
|
|
| bool | nrf_log_frontend_dequeue (void) |
|
Function for handling a single log entry.
More...
|
|
| uint32_t | nrf_log_module_cnt_get (void) |
|
Function for getting number of independent log modules registered into the logger.
More...
|
|
| const char * | nrf_log_module_name_get (uint32_t module_id, bool is_ordered_idx) |
|
Function for getting module name.
More...
|
|
| uint8_t | nrf_log_color_id_get (uint32_t module_id, nrf_log_severity_t severity) |
|
Function for getting coloring of specific logs.
More...
|
|
| void | nrf_log_module_filter_set (uint32_t backend_id, uint32_t module_id, nrf_log_severity_t severity) |
|
Function for configuring filtering ofs logs in the module.
More...
|
|
| nrf_log_severity_t | nrf_log_module_filter_get (uint32_t backend_id, uint32_t module_id, bool is_ordered_idx, bool dynamic) |
|
Function for getting module severity level.
More...
|
|
Detailed Description
The nrf_log control interface.
Macro Definition Documentation
| #define NRF_LOG_FINAL_FLUSH | ( | ) | NRF_LOG_INTERNAL_FINAL_FLUSH() |
Macro for flushing log data before reset.
- Note
- If logs are not deferred, this call has no use and is empty.
- If RTT is used, then a breakpoint is hit once flushed.
| #define NRF_LOG_FLUSH | ( | ) | NRF_LOG_INTERNAL_FLUSH() |
Macro for processing all log entries from the buffer. It blocks until all buffered entries are processed by the backend.
- Note
- If logs are not deferred, this call has no use and is empty.
| #define NRF_LOG_INIT | ( | ... | ) | NRF_LOG_INTERNAL_INIT(__VA_ARGS__) |
Macro for initializing the logs.
Macro has one or two parameters. First parameter (obligatory) is the timestamp function ( nrf_log_timestamp_func_t ). Additionally, as the second parameter timestamp frequency in Hz can be provided. If not provided then default frequency is used ( NRF_LOG_TIMESTAMP_DEFAULT_FREQUENCY ). Frequency is used to format timestamp prefix if NRF_LOG_STR_FORMATTER_TIMESTAMP_FORMAT_ENABLED is set.
- Returns
- NRF_SUCCESS after successful initialization, otherwise an error code.
| #define NRF_LOG_PROCESS | ( | ) | NRF_LOG_INTERNAL_PROCESS() |
Macro for processing a single log entry from a queue of deferred logs.
You can call this macro from the main context or from the error handler to process log entries one by one.
- Note
- If logs are not deferred, this call has no use and is defined as 'false'.
- Return values
-
true There are more logs to process in the buffer. false No more logs in the buffer.
Typedef Documentation
| typedef uint32_t(* nrf_log_timestamp_func_t)(void) |
Timestamp function prototype.
- Returns
- Timestamp value.
Function Documentation
| int32_t nrf_log_backend_add | ( | nrf_log_backend_t * | p_backend , |
| nrf_log_severity_t | severity | ||
| ) |
Function for adding new backend interface to the logger.
- Parameters
-
p_backend Pointer to the backend interface. severity Initial value of severity level for each module forwarded to the backend. This option is only applicable if NRF_LOG_FILTERS_ENABLED is set.
- Returns
- -1 if backend cannot be added or positive number (backend ID).
| void nrf_log_backend_remove | ( | nrf_log_backend_t * | p_backend | ) |
Function for removing backend from the logger.
- Parameters
-
p_backend Pointer to the backend interface.
| uint8_t nrf_log_color_id_get | ( | uint32_t | module_id , |
| nrf_log_severity_t | severity | ||
| ) |
Function for getting coloring of specific logs.
- Parameters
-
module_id Module ID. severity Log severity.
- Returns
- ID of the color.
| bool nrf_log_frontend_dequeue | ( | void | ) |
Function for handling a single log entry.
Use this function only if the logs are buffered. It takes a single entry from the buffer and attempts to process it.
- Return values
-
true If there are more entries to process. false If there are no more entries to process.
| ret_code_t nrf_log_init | ( | nrf_log_timestamp_func_t | timestamp_func , |
| uint32_t | timestamp_freq | ||
| ) |
Function for initializing the frontend and the default backend.
NRF_LOG_INIT calls this function to initialize the frontend and the backend. If custom backend is used, then NRF_LOG_INIT should not be called. Instead, frontend and user backend should be verbosely initialized.
- Parameters
-
timestamp_func Function for getting a 32-bit timestamp. timestamp_freq Frequency of the timestamp.
- Returns
- Error status.
| uint32_t nrf_log_module_cnt_get | ( | void | ) |
Function for getting number of independent log modules registered into the logger.
- Returns
- Number of registered modules.
| nrf_log_severity_t nrf_log_module_filter_get | ( | uint32_t | backend_id , |
| uint32_t | module_id , | ||
| bool | is_ordered_idx , | ||
| bool | dynamic | ||
| ) |
Function for getting module severity level.
- Parameters
-
backend_id Backend ID. module_id Module ID. is_ordered_idx Module ID is given is index in alphabetically sorted list of modules. dynamic It true current filter for given backend is returned. If false then compiled-in level is returned (maximum available). If this parameter is false then backend_id parameter is not used.
- Returns
- Severity.
| void nrf_log_module_filter_set | ( | uint32_t | backend_id , |
| uint32_t | module_id , | ||
| nrf_log_severity_t | severity | ||
| ) |
Function for configuring filtering ofs logs in the module.
Filtering of logs in modules is independent for each backend.
- Parameters
-
backend_id Backend ID which want to chenge its configuration. module_id Module ID which logs will be reconfigured. severity New severity filter.
| const char* nrf_log_module_name_get | ( | uint32_t | module_id , |
| bool | is_ordered_idx | ||
| ) |
Function for getting module name.
- Parameters
-
module_id Module ID. is_ordered_idx Module ID is given is index in alphabetically sorted list of modules.
- Returns
- Pointer to string with module name.
| void nrf_log_panic | ( | void | ) |
Function for setting logger backends into panic mode.
When this function is called all attached backends are informed about panic state of the system. It is up to the backend to react properly (hold or process logs in blocking mode, etc.)