-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog.h
More file actions
20 lines (16 loc) · 677 Bytes
/
Copy pathlog.h
File metadata and controls
20 lines (16 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* date = October 30th 2024 6:42 pm */
#ifndef LOG_H
#define LOG_H
#include "stb_sprintf.h"
#define Log(level, format, ...) {\
char buff[1024] = {0};\
int written = stbsp_snprintf(buff, ArrayCount(buff), "%s:%d: %s: ",__FILE__, __LINE__, (level));\
written += stbsp_snprintf(buff + written, ArrayCount(buff) - written, format, ##__VA_ARGS__);\
buff[written] = '\n';\
CString sbuff = {(u8*)buff, (u32)written + 1};\
OS_PrintConsole(sbuff); \
}
#define LogInfo(format, ...) { Log("Info", format, ##__VA_ARGS__); }
#define LogWarning(format, ...) { Log("Warning", format, ##__VA_ARGS__); }
#define LogError(format, ...) { Log("Error", format, ##__VA_ARGS__); }
#endif //LOG_H