Anjay Lite
Loading...
Searching...
No Matches
log_impl_decls.h File Reference

Platform hooks for log output. More...

#include <anj/init.h>
#include <stdarg.h>
#include <stddef.h>

Go to the source code of this file.

Enumerations

enum  anj_log_level_t {
  ANJ_LOG_LEVEL_L_TRACE , ANJ_LOG_LEVEL_L_DEBUG , ANJ_LOG_LEVEL_L_INFO , ANJ_LOG_LEVEL_L_WARNING ,
  ANJ_LOG_LEVEL_L_ERROR , ANJ_LOG_LEVEL_L_MUTED
}
 

Functions

void anj_log_handler_impl_full (anj_log_level_t level, const char *module, const char *file, int line, const char *format,...)
 
void anj_log_handler_output (const char *output, size_t len)
 

Detailed Description

Platform hooks for log output.

This header declares the minimal API that platform integrators may implement or override to control how Anjay Lite logs are processed:

The implementation may route logs to console, syslog, RTT, UART, or any other platform-specific output. Which functions are active depends on compile-time configuration (e.g. ANJ_LOG_FULL or ANJ_LOG_HANDLER_OUTPUT_ALT).

Enumeration Type Documentation

◆ anj_log_level_t

Specifies level of a log statement.

Note
Log macros are expecting the level without the ANJ_LOG_LEVEL_ prefix.
On design choice: the options are named L_level instead of just level to avoid collisions with applications that define e.g. DEBUG.
Enumerator
ANJ_LOG_LEVEL_L_TRACE 
ANJ_LOG_LEVEL_L_DEBUG 
ANJ_LOG_LEVEL_L_INFO 
ANJ_LOG_LEVEL_L_WARNING 
ANJ_LOG_LEVEL_L_ERROR 
ANJ_LOG_LEVEL_L_MUTED 

Function Documentation

◆ anj_log_handler_impl_full()

void anj_log_handler_impl_full ( anj_log_level_t  level,
const char *  module,
const char *  file,
int  line,
const char *  format,
  ... 
)

Full implementation of log handler, enabled if ANJ_LOG_FULL is defined.

Warning
This function is not meant to be called directly. Use the anj_log macro instead.
Parameters
levelLog level of the message.
moduleName of the module originating the log message.
fileName of the source file where the log message originates from.
lineLine number in the source file where the log message originates from.
formatprintf-style format string for the log message.
...Arguments for the format string.

◆ anj_log_handler_output()

void anj_log_handler_output ( const char *  output,
size_t  len 
)

Function used to output the formatted log strings, if one of builtin handler implementations is enabled.

Note
if ANJ_LOG_HANDLER_OUTPUT_ALT is enabled, user must implement this function.
Parameters
outputFormatted log statement to output.
lenLength of formatted log statement, effectively equal to strlen(output)