-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog.h
More file actions
32 lines (24 loc) · 919 Bytes
/
log.h
File metadata and controls
32 lines (24 loc) · 919 Bytes
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
#pragma once
#ifdef _DEBUG
void log_open(FILE** logfile, char* mode);
#define LOG_INIT(mode) \
FILE* logfile = NULL; \
do { \
log_open(&logfile, mode); \
} while(0)
#define LOG(...) \
do { \
fprintf(logfile, __VA_ARGS__); \
} while(0)
#define LOG_CLOSE() \
do { \
if (logfile != NULL) { \
fclose(logfile); \
logfile = NULL; \
} \
} while (0)
#else // _DEBUG
#define LOG_INIT(mode)
#define LOG(...)
#define LOG_CLOSE()
#endif // _DEBUG