File syn_log.c¶
Go to the source code of this file
Logging system implementation.
#include "../port/syn_port_serial.h"#include "../port/syn_port_system.h"#include "../util/syn_assert.h"#include "../util/syn_fmt.h"#include "syn_log.h"#include <stdio.h>#include <string.h>
Public Static Attributes¶
| Type | Name |
|---|---|
| bool | s_inited = false |
| SYN_LogLevel | s_level = SYN\_LOG\_DEBUG |
| const char *const | s_level_chars = "TDIWEF"Single-char level labels: T=Trace, D=Debug, I=Info, W=Warn, E=Error, F=Fatal. |
| const char *const | s_level_colors = /* multi line expression */ |
Public Functions¶
| Type | Name |
|---|---|
| void | syn_log (SYN_LogLevel level, const char * tag, const char * fmt, ...) Core log function (printf-style). |
| SYN_LogLevel | syn_log_get_level (void) Get the current runtime minimum log level. |
| void | syn_log_hexdump (const char * tag, const void * data, size_t len) Hex dump utility — output a buffer as hex + ASCII. |
| void | syn_log_init (SYN_LogLevel min_level) Initialize the logging system. |
| void | syn_log_raw (const char * str) Output a raw string with no formatting or prefix. |
| void | syn_log_set_level (SYN_LogLevel level) Change the runtime minimum log level. |
| void | syn_log_va (SYN_LogLevel level, const char * tag, const char * fmt, va_list args) Core log function (va_list variant). |
Macros¶
| Type | Name |
|---|---|
| define | LOG_COLOR_RESET "\033[0m" |
Public Static Attributes Documentation¶
variable s_inited¶
Init flag.
variable s_level¶
Current minimum log level.
variable s_level_chars¶
Single-char level labels: T=Trace, D=Debug, I=Info, W=Warn, E=Error, F=Fatal.
variable s_level_colors¶
Public Functions Documentation¶
function syn_log¶
Core log function (printf-style).
Normally called via the SYN_LOG_* macros rather than directly.
Parameters:
levelSeverity level.tagModule/component name (short string).fmtprintf-style format string....Format arguments.
function syn_log_get_level¶
Get the current runtime minimum log level.
Returns:
Current minimum level.
function syn_log_hexdump¶
Hex dump utility — output a buffer as hex + ASCII.
Parameters:
tagLog tag.dataBuffer to dump.lenNumber of bytes.
function syn_log_init¶
Initialize the logging system.
Set to 1 in syn_config.h to enable ANSI color codes.
Output goes directly to syn_port_serial_write — no callback needed.
Parameters:
min_levelMinimum runtime log level (messages below this are suppressed at runtime). Compile-time level still applies.
function syn_log_raw¶
Output a raw string with no formatting or prefix.
Useful for printing hex dumps, tables, or other pre-formatted data that shouldn't get a timestamp/level prefix.
Parameters:
strNull-terminated string to output.
function syn_log_set_level¶
Change the runtime minimum log level.
Parameters:
levelNew minimum level.
function syn_log_va¶
Core log function (va_list variant).
Parameters:
levelSeverity level.tagModule/component name.fmtprintf-style format string.argsva_list of format arguments.
Macro Definition Documentation¶
define LOG_COLOR_RESET¶
The documentation for this class was generated from the following file src/syntropic/log/syn_log.c