-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinfo.h
More file actions
77 lines (70 loc) · 1.85 KB
/
info.h
File metadata and controls
77 lines (70 loc) · 1.85 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#pragma once
#include <stdarg.h>
#include "info_def.h"
#define TAB_WIDTH 8
void info_msg(struct info_Origin origin, const info_char *prefix);
void info_printf(const info_char *format, ...);
info_String info_render(struct info_Msg msg);
struct List_DrawCall* info_parse(const info_char *text);
void info_seg_begin(const char *name, struct info_Origin org);
void info_seg_end(struct info_Origin org);
void info_hold(int);
#ifndef INFO_LVL
#define INFO_LVL 3
#endif
// MARCOS
#if INFO_LVL<3
#define INFO(...)
#define BTW(code)
#endif
#if INFO_LVL<2
#define SUCCESS(...)
#define WARNING(...)
#define SUCCESS(...)
#define SEG_BEGIN(name)
#define SEG_END
#endif
#if INFO_LVL<1
#define HOLD
#define RELEASE
#define ERROR(...)
#endif
#if INFO_LVL<0
#define FATAL(...)
#endif
#define _ORIGIN (struct info_Origin){__FILE__, __LINE__, __func__}
#define _MSG(PREFIX) info_msg(_ORIGIN, PREFIX);
#define _PRINTF(P,...) do{_MSG(P); info_printf(__VA_ARGS__);}while(0)
#define _PREFIX(TAG) "[{Time}]{Level}" TAG " {F(200,200,120): {Func} }: "
#define PRINT(...) info_printf(__VA_ARGS__)
#define MSG(code) HOLD; code RELEASE;
#ifndef INFO
#define INFO(...) _PRINTF(_PREFIX("[{F(CYAN):INFO}]"), __VA_ARGS__ )
#endif
#ifndef WARNING
#define WARNING(...) _PRINTF(_PREFIX("[{F(YELLOW):WARNING}]"), __VA_ARGS__ )
#endif
#ifndef SUCCESS
#define SUCCESS(...) _PRINTF(_PREFIX("[{F(GREEN):SUCCESS}]"), __VA_ARGS__)
#endif
#ifndef ERROR
#define ERROR(...) _PRINTF(_PREFIX("[{F(LIGHTRED):ERROR}]"), __VA_ARGS__)
#endif
#ifndef FATAL
#define FATAL(...) _PRINTF(_PREFIX("[{F(RED):FATAL}] {UL:{File}: {Line} } in"), __VA_ARGS__)
#endif
#ifndef SEG_BEGIN
#define SEG_BEGIN(name) info_seg_begin(name, _ORIGIN)
#endif
#ifndef SEG_END
#define SEG_END info_seg_end(_ORIGIN)
#endif
#ifndef HOLD
#define HOLD info_hold(1)
#endif
#ifndef RELEASE
#define RELEASE info_hold(0)
#endif
#ifndef BTW
#define BTW(code) code
#endif