summaryrefslogtreecommitdiff
path: root/log.h
blob: 47a3b7ac0e5786c7721d8d262252642da7f993bb (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* SPDX-License-Identifier: GPL-2.0 */

/** debug loglevel, gets really noisy */
#define DEBUG 1
/** still noisy, but won't fill your disk */
#define INFO  2
/** normal, but significant event */
#define NOTICE 3
/** unexpected event that can be handled */
#define WARNING 4
/** unhandled error condition */
#define ERROR 5
/** system might be unreliable */
#define CRIT 6
/** last message before exit */
#define EMERG 7

/** Not all compilers support __func__ or an equivalent. */
#if (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L) && !defined(__GNUC__)
# if defined(_MSC_VER) && _MSC_VER >= 1300
#  define __func__ __FUNCTION__
# else
#  define DSS_NO_FUNC_NAMES
#  define __func__ "<unknown>"
# endif
#endif

#define DSS_DEBUG_LOG(args) \
	do { \
		dss_log_set_params(DEBUG, __FILE__, __LINE__, __func__); \
		dss_log args ; \
	} while (0)

#define DSS_INFO_LOG(args) \
	do { \
		dss_log_set_params(INFO, __FILE__, __LINE__, __func__); \
		dss_log args ; \
	} while (0)

#define DSS_NOTICE_LOG(args) \
	do { \
		dss_log_set_params(NOTICE, __FILE__, __LINE__, __func__); \
		dss_log args ; \
	} while (0)

#define DSS_WARNING_LOG(args) \
	do { \
		dss_log_set_params(WARNING, __FILE__, __LINE__, __func__); \
		dss_log args ; \
	} while (0)

#define DSS_ERROR_LOG(args) \
	do { \
		dss_log_set_params(ERROR, __FILE__, __LINE__, __func__); \
		dss_log args ; \
	} while (0)

#define DSS_CRIT_LOG(args) \
	do { \
		dss_log_set_params(CRIT, __FILE__, __LINE__, __func__); \
		dss_log args ; \
	} while (0)

#define DSS_EMERG_LOG(args) \
	do { \
		dss_log_set_params(EMERG, __FILE__, __LINE__, __func__); \
		dss_log args ; \
	} while (0)