7#define MAX_CALLBACKS 32
40 time_t t = time(
NULL);
41 ev->time = localtime(&t);
49 buf[strftime(buf,
sizeof(buf),
"%H:%M:%S", ev->time)] =
'\0';
58 vfprintf(ev->udata, ev->fmt, ev->ap);
59 fprintf(ev->udata,
"\n");
65 buf[strftime(buf,
sizeof(buf),
"%Y-%m-%d %H:%M:%S", ev->time)] =
'\0';
74 vfprintf(ev->udata, ev->fmt, ev->ap);
75 fprintf(ev->udata,
"\n");
109 va_copy(ev.ap, args);
116 if (log_level >=
cb->level) {
118 va_copy(ev.ap, args);
125void DTTR_Log(
int level,
const char *file,
int line,
const char *
fmt, ...) {
DTTR_Graphics_COM_DirectDrawSurface7 DWORD flags void NULL
static int add_log_callback(log_LogFn fn, void *udata, int level)
void DTTR_Log(int level, const char *file, int line, const char *fmt,...)
static int current_log_level
static void init_event(log_Event *ev, void *udata)
bool DTTR_Log_IsEnabled(int log_level)
static void file_callback(log_Event *ev)
static const char * level_to_string(int level)
void DTTR_Log_Unchecked(int level, const char *file, int line, const char *fmt,...)
static void stderr_callback(log_Event *ev)
static int callback_count
static log_callback callbacks[MAX_CALLBACKS]
static void dttr_vlog_unchecked(int log_level, const char *file, int line, const char *fmt, va_list args)
void DTTR_Log_SetLevel(int log_level)
int DTTR_Log_AddFP(FILE *fp, int level)