| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Modules | Macros | Functions
Logger module
SDK common libraries

The nrf_log module interface. More...

## Modules
| Backend of nrf_log
| The nrf_log backend interface.
| Functions for controlling nrf_log
| The nrf_log control interface.
| Logging configuration

## Macros
#define | NRF_LOG_MODULE_NAME ""
| Default module name prefix. More...
#define | NRF_LOG_LEVEL NRF_LOG_DEFAULT_LEVEL
| Severity level for the module. More...
#define | NRF_LOG_DEBUG_COLOR NRF_LOG_COLOR_DEFAULT
| Color prefix of debug logs for the module. More...
#define | NRF_LOG_INFO_COLOR NRF_LOG_COLOR_DEFAULT
| Color prefix of info logs for the module. More...
#define | NRF_LOG_ERROR(...) NRF_LOG_INTERNAL_ERROR(__VA_ARGS__)
| Macro for logging error messages. It takes a printf-like, formatted string with up to seven arguments. More...
#define | NRF_LOG_WARNING(...) NRF_LOG_INTERNAL_WARNING( __VA_ARGS__)
| Macro for logging error messages. It takes a printf-like, formatted string with up to seven arguments. More...
#define | NRF_LOG_INFO(...) NRF_LOG_INTERNAL_INFO( __VA_ARGS__)
| Macro for logging error messages. It takes a printf-like, formatted string with up to seven arguments. More...
#define | NRF_LOG_DEBUG(...) NRF_LOG_INTERNAL_DEBUG( __VA_ARGS__)
| Macro for logging error messages. It takes a printf-like, formatted string with up to seven arguments. More...
#define | NRF_LOG_RAW_INFO(...) NRF_LOG_INTERNAL_RAW_INFO( __VA_ARGS__)
| A macro for logging a formatted string without any prefix or timestamp.
#define | NRF_LOG_HEXDUMP_ERROR(p_data, len) NRF_LOG_INTERNAL_HEXDUMP_ERROR(p_data, len)
| Macro for logging raw bytes. More...
#define | NRF_LOG_HEXDUMP_WARNING(p_data, len) NRF_LOG_INTERNAL_HEXDUMP_WARNING(p_data, len)
| Macro for logging raw bytes. More...
#define | NRF_LOG_HEXDUMP_INFO(p_data, len) NRF_LOG_INTERNAL_HEXDUMP_INFO(p_data, len)
| Macro for logging raw bytes. More...
#define | NRF_LOG_HEXDUMP_DEBUG(p_data, len) NRF_LOG_INTERNAL_HEXDUMP_DEBUG(p_data, len)
| Macro for logging raw bytes. More...
#define | NRF_LOG_RAW_HEXDUMP_INFO(p_data, len) NRF_LOG_INTERNAL_RAW_HEXDUMP_INFO(p_data, len)
| Macro for logging hexdump without any prefix or timestamp.
#define | NRF_LOG_GETCHAR() NRF_LOG_INTERNAL_GETCHAR()
| A macro for blocking reading from bidirectional backend used for logging. More...
#define | NRF_LOG_FLOAT_MARKER "%d.%02d"
| Macro to be used in a formatted string to a pass float number to the log. More...
#define | NRF_LOG_FLOAT(val) (int32_t)(val), (uint32_t)(((val)-(int32_t)val)*100)
| Macro for dissecting a float number into two numbers (integer and residuum).

## Functions
uint32_t | nrf_log_push (char *const p_str)
| Function for copying a string to the internal logger buffer if logs are deferred. More...

## Detailed Description

The nrf_log module interface.

## Macro Definition Documentation

#define NRF_LOG_DEBUG | ( |  | ... | ) | NRF_LOG_INTERNAL_DEBUG( __VA_ARGS__)

Macro for logging error messages. It takes a printf-like, formatted string with up to seven arguments.

This macro is compiled only if NRF_LOG_LEVEL includes debug logs.

#define NRF_LOG_DEBUG_COLOR NRF_LOG_COLOR_DEFAULT

Color prefix of debug logs for the module.

This color prefix can be defined in a module to override the default.

#define NRF_LOG_ERROR | ( |  | ... | ) | NRF_LOG_INTERNAL_ERROR(__VA_ARGS__)

Macro for logging error messages. It takes a printf-like, formatted string with up to seven arguments.

This macro is compiled only if NRF_LOG_LEVEL includes error logs.

#define NRF_LOG_FLOAT_MARKER "%d.%02d"

Macro to be used in a formatted string to a pass float number to the log.

Macro should be used in formatted string instead of the f specifier together with NRF_LOG_FLOAT macro. Example: NRF_LOG_INFO("My float number" NRF_LOG_FLOAT_MARKER "\r\n", NRF_LOG_FLOAT(f)))

#define NRF_LOG_GETCHAR | ( |  | ) | NRF_LOG_INTERNAL_GETCHAR()

A macro for blocking reading from bidirectional backend used for logging.

Macro call is blocking and returns when single byte is received.

#define NRF_LOG_HEXDUMP_DEBUG | ( |  | p_data,
|  |  | len
| ) |  | NRF_LOG_INTERNAL_HEXDUMP_DEBUG(p_data, len)

Macro for logging raw bytes.

This macro is compiled only if NRF_LOG_LEVEL includes debug logs.

Parameters

  p_data | Pointer to data.
  len | Data length in bytes.

#define NRF_LOG_HEXDUMP_ERROR | ( |  | p_data,
|  |  | len
| ) |  | NRF_LOG_INTERNAL_HEXDUMP_ERROR(p_data, len)

Macro for logging raw bytes.

It is compiled in only if NRF_LOG_LEVEL includes error logs.

Parameters

  p_data | Pointer to data.
  len | Data length in bytes.

#define NRF_LOG_HEXDUMP_INFO | ( |  | p_data,
|  |  | len
| ) |  | NRF_LOG_INTERNAL_HEXDUMP_INFO(p_data, len)

Macro for logging raw bytes.

This macro is compiled only if NRF_LOG_LEVEL includes info logs.

Parameters

  p_data | Pointer to data.
  len | Data length in bytes.

#define NRF_LOG_HEXDUMP_WARNING | ( |  | p_data,
|  |  | len
| ) |  | NRF_LOG_INTERNAL_HEXDUMP_WARNING(p_data, len)

Macro for logging raw bytes.

This macro is compiled only if NRF_LOG_LEVEL includes warning logs.

Parameters

  p_data | Pointer to data.
  len | Data length in bytes.

#define NRF_LOG_INFO | ( |  | ... | ) | NRF_LOG_INTERNAL_INFO( __VA_ARGS__)

Macro for logging error messages. It takes a printf-like, formatted string with up to seven arguments.

This macro is compiled only if NRF_LOG_LEVEL includes info logs.

#define NRF_LOG_INFO_COLOR NRF_LOG_COLOR_DEFAULT

Color prefix of info logs for the module.

This color prefix can be defined in a module to override the default.

#define NRF_LOG_LEVEL NRF_LOG_DEFAULT_LEVEL

Severity level for the module.

The severity level can be defined in a module to override the default.

#define NRF_LOG_MODULE_NAME ""

Default module name prefix.

The prefix can be defined in a module to override the default.

#define NRF_LOG_WARNING | ( |  | ... | ) | NRF_LOG_INTERNAL_WARNING( __VA_ARGS__)

Macro for logging error messages. It takes a printf-like, formatted string with up to seven arguments.

This macro is compiled only if NRF_LOG_LEVEL includes warning logs.

## Function Documentation

uint32_t nrf_log_push | ( | char *const | p_str | ) |

Function for copying a string to the internal logger buffer if logs are deferred.

Use this function to store a string that is volatile (for example allocated on stack) or that may change before the deferred logs are processed. Such string is copied into the internal logger buffer and is persistent until the log is processed.

Note
  If the logs are not deferred, then this function returns the input parameter.

Parameters

  p_str | Pointer to the user string.

Returns
  Address to the location where the string is stored in the internal logger buffer.