Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
log_output_custom.h File Reference

Go to the source code of this file.

typedef int(* log_timestamp_printer_t) (const struct log_output *output, const char *fmt,...)
 Prototype of a printer function that can print the given timestamp into a specific logger instance.
 
typedef int(* log_timestamp_format_func_t) (const struct log_output *output, const log_timestamp_t timestamp, const log_timestamp_printer_t printer)
 Prototype of the function that will apply custom formatting to a timestamp when LOG_OUTPUT_FORMAT_CUSTOM_TIMESTAMP.
 
void log_custom_output_msg_process (const struct log_output *log_output, struct log_msg *msg, uint32_t flags)
 Custom logging output formatting.
 
void log_custom_output_msg_set (log_format_func_t format)
 Set the formatting log function that will be applied with LOG_OUTPUT_CUSTOM.
 
int log_custom_timestamp_print (const struct log_output *output, const log_timestamp_t timestamp, const log_timestamp_printer_t printer)
 Format the timestamp with a external function.
 
void log_custom_timestamp_set (log_timestamp_format_func_t format)
 Set the timestamp formatting function that will be applied when LOG_OUTPUT_FORMAT_CUSTOM_TIMESTAMP.
 

Typedef Documentation

◆ log_timestamp_format_func_t

typedef int(* log_timestamp_format_func_t) (const struct log_output *output, const log_timestamp_t timestamp, const log_timestamp_printer_t printer)

Prototype of the function that will apply custom formatting to a timestamp when LOG_OUTPUT_FORMAT_CUSTOM_TIMESTAMP.

Example function:

int custom_timestamp_formatter(const struct log_output* output,
const log_timestamp_t timestamp,
const log_timestamp_printer_t printer) {
return printer(output, "%d ", timestamp);
}
uint32_t log_timestamp_t
Definition log_msg.h:36
int(* log_timestamp_printer_t)(const struct log_output *output, const char *fmt,...)
Prototype of a printer function that can print the given timestamp into a specific logger instance.
Definition log_output_custom.h:55
Log_output instance structure.
Definition log_output.h:96
Parameters
outputThe logger instance to write to
timestamp
printerThe printing function to use when formatting the timestamp.

◆ log_timestamp_printer_t

typedef int(* log_timestamp_printer_t) (const struct log_output *output, const char *fmt,...)

Prototype of a printer function that can print the given timestamp into a specific logger instance.

Example usage:

log_timestamp_printer_t *printer = ...;
printer(log_instance, "%02u:%02u", hours, minutes);
Parameters
outputThe logger instance to write to
fmtThe format string
...optional arguments for the format string

Function Documentation

◆ log_custom_output_msg_set()

void log_custom_output_msg_set ( log_format_func_t format)

Set the formatting log function that will be applied with LOG_OUTPUT_CUSTOM.

Parameters
formatPointer to the external formatter function

◆ log_custom_timestamp_print()

int log_custom_timestamp_print ( const struct log_output * output,
const log_timestamp_t timestamp,
const log_timestamp_printer_t printer )

Format the timestamp with a external function.

Function is using provided context with the buffer and output function to process formatted string and output the data.

Parameters
outputPointer to the log output instance.
timestamp
printerThe printing function to use when formatting the timestamp.

◆ log_custom_timestamp_set()

void log_custom_timestamp_set ( log_timestamp_format_func_t format)

Set the timestamp formatting function that will be applied when LOG_OUTPUT_FORMAT_CUSTOM_TIMESTAMP.

Parameters
formatPointer to the external formatter function