The nrf_log control interface.
More...
|
#define | NRF_LOG_INIT(timestamp_func) NRF_LOG_INTERNAL_INIT(timestamp_func) |
| 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...
|
|
|
enum | nrf_log_severity_t {
NRF_LOG_SEVERITY_NONE,
NRF_LOG_SEVERITY_ERROR,
NRF_LOG_SEVERITY_WARNING,
NRF_LOG_SEVERITY_INFO,
NRF_LOG_SEVERITY_DEBUG
} |
|
The nrf_log control interface.
#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 |
( |
|
timestamp_func | ) |
NRF_LOG_INTERNAL_INIT(timestamp_func) |
Macro for initializing the logs.
- Note
- If timestamps are disabled in the configuration, then the provided pointer can be NULL. Otherwise, it is expected that timestamp_getter is not NULL.
- Parameters
-
timestamp_func | Function that returns the timestamp. |
- 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 uint32_t(* nrf_log_timestamp_func_t)(void) |
Timestamp function prototype.
- Returns
- Timestamp value.
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).
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. |
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. |
- 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.)