blob: 3b7820a82048d05739b3b8a1871d483009d25967 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include "logger.h"
#include <stdio.h>
#include <time.h>
#include "raylib.h"
// cv pasted from
// https://www.raylib.com/examples/core/loader.html?name=core_custom_logging
// :tf:
void SE_Logger(int type, const char *text, va_list args) {
char timeStr[64] = {0};
time_t now = time(NULL);
struct tm *tm_info = localtime(&now);
strftime(timeStr, sizeof(timeStr), "%Y-%m-%d %H:%M:%S", tm_info);
printf("[%s] ", timeStr);
switch (type) {
case LOG_INFO:
printf("[INFO] : ");
break;
case LOG_ERROR:
printf("[ERROR]: ");
break;
case LOG_WARNING:
printf("[WARN] : ");
break;
case LOG_DEBUG:
printf("[DEBUG]: ");
break;
default:
break;
}
vprintf(text, args);
printf("\n");
}
|