nRF5 SDK v14.2.0
Modules | Macros | Functions

The nrf_log module interface. More...

Modules

 Logger backend interface
 The nrf_log backend interface.
 
 Log RTT backend
 Log RTT backend.
 
 Log UART backend
 Log UART backend.
 
 Functions for controlling nrf_log
 The nrf_log control interface.
 
 Functions for initializing and adding default backends
 The nrf_log default backends.
 
 Logger configuration
 
 Common part of serial backends
 The nrf_log serial backend common put function.
 

Macros

#define NRF_LOG_ERROR_STRING_GET(code)   ""
 
#define NRF_LOG_LEVEL   NRF_LOG_DEFAULT_LEVEL
 Severity level 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_PUSH(_str)   NRF_LOG_INTERNAL_LOG_PUSH(_str)
 A macro for copying a string to internal logger buffer if logs are deferred. More...
 
#define NRF_LOG_FLOAT_MARKER   "%s%d.%02d"
 Macro to be used in a formatted string to a pass float number to the log. More...
 
#define NRF_LOG_FLOAT(val)
 Macro for dissecting a float number into two numbers (integer and residuum). More...
 
#define NRF_LOG_MODULE_REGISTER()   /*lint -save -e19*/ /*lint -restore*/
 Macro for registering an independent module.
 

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_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 (   val)
Value:
(uint32_t)(((val) < 0 && (val) > -1.0) ? "-" : ""), \
(int32_t)(val), \
(int32_t)((((val) > 0) ? (val) - (int32_t)(val) \
: (int32_t)(val) - (val))*100)

Macro for dissecting a float number into two numbers (integer and residuum).

#define NRF_LOG_FLOAT_MARKER   "%s%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_dataPointer to data.
lenData 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_dataPointer to data.
lenData 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_dataPointer to data.
lenData 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_dataPointer to data.
lenData 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_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_PUSH (   _str)    NRF_LOG_INTERNAL_LOG_PUSH(_str)

A macro for copying a string to internal logger buffer if logs are deferred.

Parameters
_strString.
#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_strPointer to the user string.
Returns
Address to the location where the string is stored in the internal logger buffer.

Documentation feedback | Developer Zone | Subscribe | Updated