README, INSTALL improvements.
[dss.git] / log.h
1 /*
2 * Copyright (C) 1997-2008 Andre Noll <maan@systemlinux.org>
3 *
4 * Licensed under the GPL v2. For licencing details see COPYING.
5 */
6
7 /** debug loglevel, gets really noisy */
8 #define DEBUG 1
9 /** still noisy, but won't fill your disk */
10 #define INFO 2
11 /** normal, but significant event */
12 #define NOTICE 3
13 /** unexpected event that can be handled */
14 #define WARNING 4
15 /** unhandled error condition */
16 #define ERROR 5
17 /** system might be unreliable */
18 #define CRIT 6
19 /** last message before exit */
20 #define EMERG 7
21
22 /** Log messages with lower priority than that will not be compiled in. */
23 #define COMPILE_TIME_LOGLEVEL 0
24
25 /** \cond */
26 #if DEBUG > COMPILE_TIME_LOGLEVEL
27 #define DSS_DEBUG_LOG(f,...) dss_log(DEBUG, "%s: " f, __FUNCTION__, ## __VA_ARGS__)
28 #else
29 #define DSS_DEBUG_LOG(...) do {;} while (0)
30 #endif
31
32 #if INFO > COMPILE_TIME_LOGLEVEL
33 #define DSS_INFO_LOG(f,...) dss_log(INFO, "%s: " f, __FUNCTION__, ## __VA_ARGS__)
34 #else
35 #define DSS_INFO_LOG(...) do {;} while (0)
36 #endif
37
38 #if NOTICE > COMPILE_TIME_LOGLEVEL
39 #define DSS_NOTICE_LOG(f,...) dss_log(NOTICE, "%s: " f, __FUNCTION__, ## __VA_ARGS__)
40 #else
41 #define DSS_NOTICE_LOG(...) do {;} while (0)
42 #endif
43
44 #if WARNING > COMPILE_TIME_LOGLEVEL
45 #define DSS_WARNING_LOG(f,...) dss_log(WARNING, "%s: " f, __FUNCTION__, ## __VA_ARGS__)
46 #else
47 #define DSS_WARNING_LOG(...) do {;} while (0)
48 #endif
49
50 #if ERROR > COMPILE_TIME_LOGLEVEL
51 #define DSS_ERROR_LOG(f,...) dss_log(ERROR, "%s: " f, __FUNCTION__, ## __VA_ARGS__)
52 #else
53 #define DSS_ERROR_LOG(...) do {;} while (0)
54 #endif
55
56 #if CRIT > COMPILE_TIME_LOGLEVEL
57 #define DSS_CRIT_LOG(f,...) dss_log(CRIT, "%s: " f, __FUNCTION__, ## __VA_ARGS__)
58 #else
59 #define DSS_CRIT_LOG(...) do {;} while (0)
60 #endif
61
62 #if EMERG > COMPILE_TIME_LOGLEVEL
63 #define DSS_EMERG_LOG(f,...) dss_log(EMERG, "%s: " f, __FUNCTION__, ## __VA_ARGS__)
64 #else
65 #define DSS_EMERG_LOG(...)
66 #endif