-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogging.h
More file actions
42 lines (31 loc) · 834 Bytes
/
Copy pathlogging.h
File metadata and controls
42 lines (31 loc) · 834 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
33
34
35
36
37
38
39
40
41
42
#ifndef LOGGING_H
#define LOGGING_H
#include <stdio.h>
#include <stdlib.h>
#define COL_FATAL "\x1B[31m" /* red terminal */
#define COL_SUCCESS "\x1B[32m" /* green terminal */
#define COL_DEBUG "\x1B[36m" /* cyan terminal */
#define COL_RESET "\x1B[0m"
#ifdef DEBUG
#define LOG_DEBUG(...) \
printf(COL_DEBUG); \
printf( __VA_ARGS__); \
printf(COL_RESET)
#define LOG_SUCCESS(...) \
printf(COL_SUCCESS); \
printf(__VA_ARGS__); \
printf(COL_RESET)
#else
#define LOG_DEBUG(...)
#define LOG_SUCCESS(...)
#endif // DEBUG
#define LOG_INFO(...) \
printf(COL_DEBUG); \
printf( __VA_ARGS__); \
printf(COL_RESET)
#define LOG_FATAL(...) \
printf(COL_FATAL); \
printf(__VA_ARGS__); \
printf(COL_RESET); \
exit(EXIT_FAILURE)
#endif // LOGGING_H