$darkmode
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
log.c File Reference
#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 <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <time.h>
Include dependency graph for log.c:

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. More...
 
void log_set_callback (LogCallback callback)
 Sets a custom callback for log messages. More...
 
LogLevel log_get_level (void)
 Retrieves the current global log level. More...
 
void log_message (LogLevel level, const char *tag, const char *format,...)
 Logs a formatted message. More...
 

Variables

static LogLevel g_log_level = LOG_LEVEL_INFO
 
static bool g_log_initialized = false
 
static LogCallback g_log_callback = NULL
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MILLI_DIVISOR 
PREFIX_BUFFER_SIZE 
TIME_BUFFER_SIZE 
MSG_BUFFER_SIZE 

Function Documentation

◆ level_to_string()

static const char* level_to_string ( LogLevel  level)
static

◆ log_get_level()

LogLevel log_get_level ( void  )

Retrieves the current global log level.

Returns
Active LogLevel.
Here is the call graph for this function:

◆ log_init()

static void log_init ( void  )
static
Here is the call graph for this function:

◆ log_message()

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

Parameters
levelSeverity level.
tagCategory label (e.g., "RENDER", "INPUT").
formatPrintf-style format string.
...Arguments for the format string.
Here is the call graph for this function:

◆ log_set_callback()

void log_set_callback ( LogCallback  callback)

Sets a custom callback for log messages.

Parameters
callbackFunction to call for each log message, or NULL to disable.

◆ log_set_level()

void log_set_level ( LogLevel  level)

Sets the global minimum log level.

Parameters
levelLevels below this will be ignored.

◆ string_to_level()

static LogLevel string_to_level ( const char *  str)
static

Variable Documentation

◆ g_log_callback

LogCallback g_log_callback = NULL
static

◆ g_log_initialized

bool g_log_initialized = false
static

◆ g_log_level

LogLevel g_log_level = LOG_LEVEL_INFO
static