-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogging.h
40 lines (34 loc) · 933 Bytes
/
logging.h
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
/*
* Copyright (C) 2024 TDT AG <[email protected]>
*
* This is free software, licensed under the GNU General Public License v2.
* See https://www.gnu.org/licenses/gpl-2.0.txt for more information.
*
*/
#ifndef _LOGGING_H
#define _LOGGING_H
enum loglevel {
LL_CRIT = 2,
LL_ERR,
LL_WARN,
LL_NOTICE,
LL_INFO,
LL_DEBUG
};
void logging_out(enum loglevel, const char* fmt, ...);
void logging_open(const char* name);
void logging_close(void);
#ifdef DEBUG
#define DEBUG 1
#endif
#define LOGGING_CRIT(...) logging_out(LL_CRIT, __VA_ARGS__)
#define LOGGING_ERR(...) logging_out(LL_ERR, __VA_ARGS__)
#define LOGGING_WARN(...) logging_out(LL_WARN, __VA_ARGS__)
#define LOGGING_NOTICE(...) logging_out(LL_NOTICE, __VA_ARGS__)
#define LOGGING_INFO(...) logging_out(LL_INFO, __VA_ARGS__)
#define LOGGING_DEBUG(...) \
do { \
if (DEBUG) \
logging_out(LL_DEBUG, __VA_ARGS__); \
} while (0)
#endif /* _LOGGGING_H */