|
WinTer 0.1.1
Windows Terminal Emulator
|
Implementation of the leveled logging subsystem. More...

Go to the source code of this file.
Classes | |
| struct | Callback |
| Internal structure to hold a logging callback and its configuration. More... | |
| struct | Logger |
| Internal state structure for the global logger. More... | |
Macros | |
| #define | MAX_CALLBACKS 4 |
| Maximum number of custom log callbacks supported simultaneously. | |
| #define | COLOR_TRACE "" |
| Empty string fallback for Windows trace color. | |
| #define | COLOR_DEBUG "" |
| Empty string fallback for Windows debug color. | |
| #define | COLOR_INFO "" |
| Empty string fallback for Windows info color. | |
| #define | COLOR_WARN "" |
| Empty string fallback for Windows warn color. | |
| #define | COLOR_ERROR "" |
| Empty string fallback for Windows error color. | |
| #define | COLOR_FATAL "" |
| Empty string fallback for Windows fatal color. | |
| #define | COLOR_RESET "" |
| Empty string fallback for Windows reset color. | |
Typedefs | |
| typedef struct Callback | Callback |
| Internal structure to hold a logging callback and its configuration. | |
| typedef struct Logger | Logger |
| Internal state structure for the global logger. | |
Functions | |
| static void | lock (void) |
| Acquires the logger lock if a locking function is configured. | |
| static void | unlock (void) |
| Releases the logger lock if a locking function is configured. | |
| static void | log_stdout (LogEvent *ev) |
| Formats and writes a log event to standard output or standard error. | |
| static void | file_callback (LogEvent *ev, void *user_data) |
| Default callback used to write log events to a standard C FILE*. | |
| void | log_set_level (LogLevel level) |
| Configures the active logging level. Messages below this level are ignored. | |
| void | log_set_quiet (b32 enable) |
| Mutes or unmutes all console (stdout/stderr) output. | |
| void | log_set_lock (LogLockFn fn, void *user_data) |
| Configures thread-safety by providing a custom locking mechanism. | |
| b32 | log_add_fp (FILE *fp, LogLevel min_level) |
| Adds a standard C FILE* pointer as a logging destination. | |
| b32 | log_add_callback (LogFn fn, void *user_data, LogLevel min_level) |
| Adds a custom callback function as a logging destination. | |
| void | log_message (LogLevel level, const char *file, int line, const char *fmt,...) |
| Internal function that actually processes the log. DO NOT call directly. | |
Variables | |
| static Logger | L = {.level = LOG_LEVEL_TRACE} |
| The single global logger instance state. | |
| static const char * | level_strings [] = {"TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL"} |
| Human-readable string representations of the log levels. | |
| static const char * | level_colors [] |
| Array mapping log levels to their respective ANSI color codes. | |
Implementation of the leveled logging subsystem.
Definition in file base_log.c.
| #define COLOR_DEBUG "" |
Empty string fallback for Windows debug color.
Definition at line 42 of file base_log.c.
| #define COLOR_ERROR "" |
Empty string fallback for Windows error color.
Definition at line 48 of file base_log.c.
| #define COLOR_FATAL "" |
Empty string fallback for Windows fatal color.
Definition at line 50 of file base_log.c.
| #define COLOR_INFO "" |
Empty string fallback for Windows info color.
Definition at line 44 of file base_log.c.
| #define COLOR_RESET "" |
Empty string fallback for Windows reset color.
Definition at line 52 of file base_log.c.
| #define COLOR_TRACE "" |
Empty string fallback for Windows trace color.
Definition at line 40 of file base_log.c.
| #define COLOR_WARN "" |
Empty string fallback for Windows warn color.
Definition at line 46 of file base_log.c.
| #define MAX_CALLBACKS 4 |
Maximum number of custom log callbacks supported simultaneously.
Definition at line 13 of file base_log.c.
| typedef struct Callback Callback |
Internal structure to hold a logging callback and its configuration.
| typedef struct Logger Logger |
Internal state structure for the global logger.
|
static |
Default callback used to write log events to a standard C FILE*.
| ev | The log event to process. |
| user_data | An active FILE* pointer cast to void*. |
Definition at line 127 of file base_log.c.

|
static |
Acquires the logger lock if a locking function is configured.
Definition at line 78 of file base_log.c.

|
static |
Formats and writes a log event to standard output or standard error.
| ev | The log event to process. |
Definition at line 99 of file base_log.c.

|
static |
Releases the logger lock if a locking function is configured.
Definition at line 87 of file base_log.c.

|
static |
The single global logger instance state.
Definition at line 32 of file base_log.c.
|
static |
Array mapping log levels to their respective ANSI color codes.
Definition at line 71 of file base_log.c.
|
static |
Human-readable string representations of the log levels.
Definition at line 35 of file base_log.c.