Zephyr API 3.6.99
Loading...
Searching...
No Matches
log_output.h File Reference
#include <zephyr/logging/log_msg.h>
#include <zephyr/sys/util.h>
#include <stdarg.h>
#include <zephyr/sys/atomic.h>
#include <zephyr/kernel.h>

Go to the source code of this file.

Data Structures

struct  log_output_control_block
 
struct  log_output
 Log_output instance structure. More...
 

Macros

#define LOG_OUTPUT_FLAG_COLORS   BIT(0)
 Flag forcing ANSI escape code colors, red (errors), yellow (warnings).
 
#define LOG_OUTPUT_FLAG_TIMESTAMP   BIT(1)
 Flag forcing timestamp.
 
#define LOG_OUTPUT_FLAG_FORMAT_TIMESTAMP   BIT(2)
 Flag forcing timestamp formatting.
 
#define LOG_OUTPUT_FLAG_LEVEL   BIT(3)
 Flag forcing severity level prefix.
 
#define LOG_OUTPUT_FLAG_CRLF_NONE   BIT(4)
 Flag preventing the logger from adding CR and LF characters.
 
#define LOG_OUTPUT_FLAG_CRLF_LFONLY   BIT(5)
 Flag forcing a single LF character for line breaks.
 
#define LOG_OUTPUT_FLAG_FORMAT_SYSLOG   BIT(6)
 Flag forcing syslog format specified in RFC 5424.
 
#define LOG_OUTPUT_FLAG_THREAD   BIT(7)
 Flag thread id or name prefix.
 
#define LOG_OUTPUT_FLAG_SKIP_SOURCE   BIT(8)
 Flag forcing to skip logging the source.
 
#define LOG_OUTPUT_TEXT   0
 Supported backend logging format types for use with log_format_set() API to switch log format at runtime.
 
#define LOG_OUTPUT_SYST   1
 
#define LOG_OUTPUT_DICT   2
 
#define LOG_OUTPUT_CUSTOM   3
 
#define LOG_OUTPUT_DEFINE(_name, _func, _buf, _size)
 Create log_output instance.
 

Typedefs

typedef int(* log_output_func_t) (uint8_t *buf, size_t size, void *ctx)
 Prototype of the function processing output data.
 
typedef void(* log_format_func_t) (const struct log_output *output, struct log_msg *msg, uint32_t flags)
 Typedef of the function pointer table "format_table".
 

Functions

log_format_func_t log_format_func_t_get (uint32_t log_type)
 Declaration of the get routine for function pointer table format_table.
 
void log_output_msg_process (const struct log_output *log_output, struct log_msg *msg, uint32_t flags)
 Process log messages v2 to readable strings.
 
void log_output_process (const struct log_output *log_output, log_timestamp_t timestamp, const char *domain, const char *source, k_tid_t tid, uint8_t level, const uint8_t *package, const uint8_t *data, size_t data_len, uint32_t flags)
 Process input data to a readable string.
 
void log_output_msg_syst_process (const struct log_output *log_output, struct log_msg *msg, uint32_t flags)
 Process log messages v2 to SYS-T format.
 
void log_output_dropped_process (const struct log_output *output, uint32_t cnt)
 Process dropped messages indication.
 
static void log_output_write (log_output_func_t outf, uint8_t *buf, size_t len, void *ctx)
 Write to the output buffer.
 
static void log_output_flush (const struct log_output *output)
 Flush output buffer.
 
static void log_output_ctx_set (const struct log_output *output, void *ctx)
 Function for setting user context passed to the output function.
 
static void log_output_hostname_set (const struct log_output *output, const char *hostname)
 Function for setting hostname of this device.
 
void log_output_timestamp_freq_set (uint32_t freq)
 Set timestamp frequency.
 
uint64_t log_output_timestamp_to_us (log_timestamp_t timestamp)
 Convert timestamp of the message to us.