|
cbase 1.46.11
C/C++ Static Template
|
Classes | |
| struct | LogEvent |
| A structured event containing all metadata for a single log message. More... | |
Typedefs | |
| typedef enum LogLevel | LogLevel |
| The severity level of a log message. | |
| typedef struct LogEvent | LogEvent |
| A structured event containing all metadata for a single log message. | |
| typedef void(* | LogFn) (LogEvent *ev, void *user_data) |
| Signature for custom logging destination callbacks. | |
| typedef void(* | LogLockFn) (void *user_data, b32 lock) |
| Signature for the thread-synchronization callback. | |
Enumerations | |
| enum | LogLevel { LOG_LEVEL_TRACE , LOG_LEVEL_DEBUG , LOG_LEVEL_INFO , LOG_LEVEL_WARN , LOG_LEVEL_ERROR , LOG_LEVEL_FATAL , LOG_LEVEL_COUNT } |
| The severity level of a log message. More... | |
Functions | |
| 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. | |
| typedef void(* LogFn) (LogEvent *ev, void *user_data) |
Signature for custom logging destination callbacks.
Definition at line 62 of file base_log.h.
Signature for the thread-synchronization callback.
Definition at line 65 of file base_log.h.
| enum LogLevel |
The severity level of a log message.
Definition at line 42 of file base_log.h.
Adds a custom callback function as a logging destination.
| fn | The function pointer to invoke for every log event. |
| user_data | Opaque pointer passed to the callback. |
| min_level | The minimum severity level to send to this callback. |
Definition at line 166 of file base_log.c.

Adds a standard C FILE* pointer as a logging destination.
| fp | The file pointer (must be opened in "a" or "w" mode). |
| min_level | The minimum severity level to write to this file. |
Definition at line 160 of file base_log.c.

| void log_message | ( | LogLevel | level, |
| const char * | file, | ||
| int | line, | ||
| const char * | fmt, | ||
| ... ) |
Internal function that actually processes the log. DO NOT call directly.
Definition at line 180 of file base_log.c.

| void log_set_level | ( | LogLevel | level | ) |
Configures the active logging level. Messages below this level are ignored.
| level | The minimum level to output (e.g., LOG_LEVEL_INFO). |
Definition at line 141 of file base_log.c.
| void log_set_lock | ( | LogLockFn | fn, |
| void * | user_data ) |
Configures thread-safety by providing a custom locking mechanism.
| fn | The callback to invoke when a lock/unlock is required. |
| user_data | Opaque pointer passed to the locking callback (e.g., a Mutex). |
Definition at line 153 of file base_log.c.
| void log_set_quiet | ( | b32 | enable | ) |
Mutes or unmutes all console (stdout/stderr) output.
| enable | 1 (true) to mute console output, 0 (false) to enable it. |
Definition at line 147 of file base_log.c.