]> git.tuebingen.mpg.de Git - dss.git/blob - log.h
Merge topic branch t/misc into pu
[dss.git] / log.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2
3 /** debug loglevel, gets really noisy */
4 #define DEBUG 1
5 /** still noisy, but won't fill your disk */
6 #define INFO  2
7 /** normal, but significant event */
8 #define NOTICE 3
9 /** unexpected event that can be handled */
10 #define WARNING 4
11 /** unhandled error condition */
12 #define ERROR 5
13 /** system might be unreliable */
14 #define CRIT 6
15 /** last message before exit */
16 #define EMERG 7
17
18 /** Not all compilers support __func__ or an equivalent. */
19 #if (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L) && !defined(__GNUC__)
20 # if defined(_MSC_VER) && _MSC_VER >= 1300
21 #  define __func__ __FUNCTION__
22 # else
23 #  define DSS_NO_FUNC_NAMES
24 #  define __func__ "<unknown>"
25 # endif
26 #endif
27
28 #define DSS_DEBUG_LOG(args) \
29         do { \
30                 dss_log_set_params(DEBUG, __FILE__, __LINE__, __func__); \
31                 dss_log args ; \
32         } while (0)
33
34 #define DSS_INFO_LOG(args) \
35         do { \
36                 dss_log_set_params(INFO, __FILE__, __LINE__, __func__); \
37                 dss_log args ; \
38         } while (0)
39
40 #define DSS_NOTICE_LOG(args) \
41         do { \
42                 dss_log_set_params(NOTICE, __FILE__, __LINE__, __func__); \
43                 dss_log args ; \
44         } while (0)
45
46 #define DSS_WARNING_LOG(args) \
47         do { \
48                 dss_log_set_params(WARNING, __FILE__, __LINE__, __func__); \
49                 dss_log args ; \
50         } while (0)
51
52 #define DSS_ERROR_LOG(args) \
53         do { \
54                 dss_log_set_params(ERROR, __FILE__, __LINE__, __func__); \
55                 dss_log args ; \
56         } while (0)
57
58 #define DSS_CRIT_LOG(args) \
59         do { \
60                 dss_log_set_params(CRIT, __FILE__, __LINE__, __func__); \
61                 dss_log args ; \
62         } while (0)
63
64 #define DSS_EMERG_LOG(args) \
65         do { \
66                 dss_log_set_params(EMERG, __FILE__, __LINE__, __func__); \
67                 dss_log args ; \
68         } while (0)