aboutsummaryrefslogtreecommitdiff
path: root/client/acronc/log.h
blob: 7bc95321767a8b3296edbfb5606f8b7de4293d70 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 * Created by yuuta on 1/1/22.
 */

#ifndef LOG_H
#define LOG_H

enum log_level {
    log_fetal = 1,
    log_error = 2,
    log_warn = 3,
    log_info = 4,
    log_debug = 5
};

void g_log(enum log_level level,
           const char *file,
           int line,
           const char *format,
           ...);

#define LOGF(X) g_log(log_fetal, __FUNCTION__, __LINE__, X)

#define LOGFV(X, ...) g_log(log_fetal, __FUNCTION__, __LINE__, X, __VA_ARGS__)

#define LOGE(X) g_log(log_error, __FUNCTION__, __LINE__, X)

#define LOGEV(X, ...) g_log(log_error, __FUNCTION__, __LINE__, X, __VA_ARGS__)

#define LOGW(X) g_log(log_warn, __FUNCTION__, __LINE__, X)

#define LOGWV(X, ...) g_log(log_warn, __FUNCTION__, __LINE__, X, __VA_ARGS__)

#define LOGI(X) g_log(log_info, __FUNCTION__, __LINE__, X)

#define LOGIV(X, ...) g_log(log_info, __FUNCTION__, __LINE__, X, __VA_ARGS__)

#ifdef DEBUG

#define LOGD(X) g_log(log_debug, __FUNCTION__, __LINE__, X)

#define LOGDV(X, ...) g_log(log_debug, __FUNCTION__, __LINE__, X, __VA_ARGS__)

#else

#define LOGD(X)

#define LOGDV(X, ...)

#endif

#endif /* LOG_H */