Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Log output API. More...
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). More... | |
#define | LOG_OUTPUT_FLAG_TIMESTAMP BIT(1) |
Flag forcing timestamp. More... | |
#define | LOG_OUTPUT_FLAG_FORMAT_TIMESTAMP BIT(2) |
Flag forcing timestamp formatting. More... | |
#define | LOG_OUTPUT_FLAG_LEVEL BIT(3) |
Flag forcing severity level prefix. More... | |
#define | LOG_OUTPUT_FLAG_CRLF_NONE BIT(4) |
Flag preventing the logger from adding CR and LF characters. More... | |
#define | LOG_OUTPUT_FLAG_CRLF_LFONLY BIT(5) |
Flag forcing a single LF character for line breaks. More... | |
#define | LOG_OUTPUT_FLAG_FORMAT_SYSLOG BIT(6) |
Flag forcing syslog format specified in RFC 5424. More... | |
#define | LOG_OUTPUT_FLAG_FORMAT_SYST BIT(7) |
Flag forcing syslog format specified in mipi sys-t. More... | |
#define | LOG_OUTPUT_DEFINE(_name, _func, _buf, _size) |
Create log_output instance. More... | |
Typedefs | |
typedef int(* | log_output_func_t) (uint8_t *buf, size_t size, void *ctx) |
Prototype of the function processing output data. More... | |
Functions | |
void | log_output_msg_process (const struct log_output *output, struct log_msg *msg, uint32_t flags) |
Process log messages to readable strings. More... | |
void | log_output_msg2_process (const struct log_output *log_output, struct log_msg2 *msg, uint32_t flags) |
Process log messages v2 to readable strings. More... | |
void | log_output_string (const struct log_output *output, struct log_msg_ids src_level, uint32_t timestamp, const char *fmt, va_list ap, uint32_t flags) |
Process log string. More... | |
void | log_output_hexdump (const struct log_output *output, struct log_msg_ids src_level, uint32_t timestamp, const char *metadata, const uint8_t *data, uint32_t length, uint32_t flags) |
Process log hexdump. More... | |
void | log_output_dropped_process (const struct log_output *output, uint32_t cnt) |
Process dropped messages indication. More... | |
void | log_output_flush (const struct log_output *output) |
Flush output buffer. More... | |
static void | log_output_ctx_set (const struct log_output *output, void *ctx) |
Function for setting user context passed to the output function. More... | |
static void | log_output_hostname_set (const struct log_output *output, const char *hostname) |
Function for setting hostname of this device. More... | |
void | log_output_timestamp_freq_set (uint32_t freq) |
Set timestamp frequency. More... | |
uint64_t | log_output_timestamp_to_us (uint32_t timestamp) |
Convert timestamp of the message to us. More... | |
Log output API.
#define LOG_OUTPUT_DEFINE | ( | _name, | |
_func, | |||
_buf, | |||
_size | |||
) |
#include <include/logging/log_output.h>
Create log_output instance.
_name | Instance name. |
_func | Function for processing output data. |
_buf | Pointer to the output buffer. |
_size | Size of the output buffer. |
#define LOG_OUTPUT_FLAG_COLORS BIT(0) |
#include <include/logging/log_output.h>
Flag forcing ANSI escape code colors, red (errors), yellow (warnings).
#define LOG_OUTPUT_FLAG_CRLF_LFONLY BIT(5) |
#include <include/logging/log_output.h>
Flag forcing a single LF character for line breaks.
#define LOG_OUTPUT_FLAG_CRLF_NONE BIT(4) |
#include <include/logging/log_output.h>
Flag preventing the logger from adding CR and LF characters.
#define LOG_OUTPUT_FLAG_FORMAT_SYSLOG BIT(6) |
#include <include/logging/log_output.h>
Flag forcing syslog format specified in RFC 5424.
#define LOG_OUTPUT_FLAG_FORMAT_SYST BIT(7) |
#include <include/logging/log_output.h>
Flag forcing syslog format specified in mipi sys-t.
#define LOG_OUTPUT_FLAG_FORMAT_TIMESTAMP BIT(2) |
#include <include/logging/log_output.h>
Flag forcing timestamp formatting.
#define LOG_OUTPUT_FLAG_LEVEL BIT(3) |
#include <include/logging/log_output.h>
Flag forcing severity level prefix.
#define LOG_OUTPUT_FLAG_TIMESTAMP BIT(1) |
#include <include/logging/log_output.h>
Flag forcing timestamp.
#include <include/logging/log_output.h>
Prototype of the function processing output data.
buf | The buffer data. |
size | The buffer size. |
ctx | User context. |
|
inlinestatic |
#include <include/logging/log_output.h>
Function for setting user context passed to the output function.
output | Pointer to the log output instance. |
ctx | User context. |
void log_output_dropped_process | ( | const struct log_output * | output, |
uint32_t | cnt | ||
) |
#include <include/logging/log_output.h>
Process dropped messages indication.
Function prints error message indicating lost log messages.
output | Pointer to the log output instance. |
cnt | Number of dropped messages. |
void log_output_flush | ( | const struct log_output * | output | ) |
#include <include/logging/log_output.h>
Flush output buffer.
output | Pointer to the log output instance. |
void log_output_hexdump | ( | const struct log_output * | output, |
struct log_msg_ids | src_level, | ||
uint32_t | timestamp, | ||
const char * | metadata, | ||
const uint8_t * | data, | ||
uint32_t | length, | ||
uint32_t | flags | ||
) |
#include <include/logging/log_output.h>
Process log hexdump.
Function is formatting provided hexdump adding optional prefixes and postfixes.
output | Pointer to log_output instance. |
src_level | Log source and level structure. |
timestamp | Timestamp. |
metadata | String. |
data | Data. |
length | Data length. |
flags | Optional flags. |
|
inlinestatic |
#include <include/logging/log_output.h>
Function for setting hostname of this device.
output | Pointer to the log output instance. |
hostname | Hostname of this device |
void log_output_msg2_process | ( | const struct log_output * | log_output, |
struct log_msg2 * | msg, | ||
uint32_t | flags | ||
) |
#include <include/logging/log_output.h>
Process log messages v2 to readable strings.
Function is using provided context with the buffer and output function to process formatted string and output the data.
log_output | Pointer to the log output instance. |
msg | Log message. |
flags | Optional flags. |
void log_output_msg_process | ( | const struct log_output * | output, |
struct log_msg * | msg, | ||
uint32_t | flags | ||
) |
#include <include/logging/log_output.h>
Process log messages to readable strings.
Function is using provided context with the buffer and output function to process formatted string and output the data.
output | Pointer to the log output instance. |
msg | Log message. |
flags | Optional flags. |
void log_output_string | ( | const struct log_output * | output, |
struct log_msg_ids | src_level, | ||
uint32_t | timestamp, | ||
const char * | fmt, | ||
va_list | ap, | ||
uint32_t | flags | ||
) |
#include <include/logging/log_output.h>
Process log string.
Function is formatting provided string adding optional prefixes and postfixes.
output | Pointer to log_output instance. |
src_level | Log source and level structure. |
timestamp | Timestamp. |
fmt | String. |
ap | String arguments. |
flags | Optional flags. |
#include <include/logging/log_output.h>
Convert timestamp of the message to us.
timestamp | Message timestamp |