|
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
|
#include "log.h"#include "platform/platform_time.h"#include "platform/platform_utils.h"#include "tracy_log.h"#include "utils.h"#include <stdarg.h>#include <stdbool.h>#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include <strings.h>#include <time.h>#include <pthread.h>Macros | |
| #define | LOG_PLATFORM_POSIX |
| #define | LOG_MUTEX_TYPE pthread_mutex_t |
| #define | LOG_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER |
| #define | LOG_MUTEX_LOCK(m) pthread_mutex_lock(m) |
| #define | LOG_MUTEX_UNLOCK(m) pthread_mutex_unlock(m) |
Enumerations | |
| enum | { MILLI_DIVISOR = 1000000 , PREFIX_BUFFER_SIZE = 128 , TIME_BUFFER_SIZE = 24 , MSG_BUFFER_SIZE = 1024 } |
Functions | |
| static LogLevel | string_to_level (const char *str) |
| static void | log_init (void) |
| static const char * | level_to_string (LogLevel level) |
| void | log_set_level (LogLevel level) |
| Sets the global minimum log level. | |
| void | log_set_callback (LogCallback callback) |
| Sets a custom callback for log messages. | |
| LogLevel | log_get_level (void) |
| Retrieves the current global log level. | |
| void | log_message (LogLevel level, const char *tag, const char *format,...) |
| Logs a formatted message. | |
Variables | |
| static LogLevel | g_log_level = LOG_LEVEL_INFO |
| static bool | g_log_initialized = false |
| static LogCallback | g_log_callback = NULL |
| #define LOG_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER |
| #define LOG_MUTEX_LOCK | ( | m | ) | pthread_mutex_lock(m) |
| #define LOG_MUTEX_TYPE pthread_mutex_t |
| #define LOG_MUTEX_UNLOCK | ( | m | ) | pthread_mutex_unlock(m) |
| #define LOG_PLATFORM_POSIX |
|
static |
| LogLevel log_get_level | ( | void | ) |
Retrieves the current global log level.
|
static |
| void log_message | ( | LogLevel | level, |
| const char * | tag, | ||
| const char * | format, | ||
| ... | |||
| ) |
Logs a formatted message.
Format: YYYY-MM-DD HH:MM:SS,mmm - tag - LEVEL - message
| level | Severity level. |
| tag | Category label (e.g., "RENDER", "INPUT"). |
| format | Printf-style format string. |
| ... | Arguments for the format string. |
| void log_set_callback | ( | LogCallback | callback | ) |
Sets a custom callback for log messages.
| callback | Function to call for each log message, or NULL to disable. |
| void log_set_level | ( | LogLevel | level | ) |
Sets the global minimum log level.
| level | Levels below this will be ignored. |
|
static |
|
static |
|
static |
|
static |