]>
Commit | Line | Data |
---|---|---|
54988802 | 1 | /* |
05230184 | 2 | * logging.h |
54988802 KS |
3 | * |
4 | * Userspace devfs | |
5 | * | |
6 | * Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com> | |
7 | * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org> | |
8 | * | |
9 | * This program is free software; you can redistribute it and/or modify it | |
10 | * under the terms of the GNU General Public License as published by the | |
11 | * Free Software Foundation version 2 of the License. | |
12 | * | |
13 | * This program is distributed in the hope that it will be useful, but | |
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | * General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License along | |
19 | * with this program; if not, write to the Free Software Foundation, Inc., | |
20 | * 675 Mass Ave, Cambridge, MA 02139, USA. | |
21 | * | |
22 | */ | |
23 | ||
24 | #ifndef LOGGING_H | |
25 | #define LOGGING_H | |
26 | ||
f10fec81 GKH |
27 | #define info(format, arg...) do { } while (0) |
28 | #define dbg(format, arg...) do { } while (0) | |
29 | #define dbg_parse(format, arg...) do { } while (0) | |
30 | ||
54988802 KS |
31 | #ifdef LOG |
32 | #include <syslog.h> | |
f10fec81 GKH |
33 | |
34 | #undef info | |
54988802 KS |
35 | #define info(format, arg...) \ |
36 | do { \ | |
267f534d | 37 | log_message (LOG_INFO , format , ## arg); \ |
54988802 | 38 | } while (0) |
54988802 KS |
39 | |
40 | #ifdef DEBUG | |
f10fec81 | 41 | #undef dbg |
54988802 KS |
42 | #define dbg(format, arg...) \ |
43 | do { \ | |
44 | log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ | |
45 | } while (0) | |
54988802 KS |
46 | #endif |
47 | ||
48 | /* Parser needs it's own debugging statement, we usually don't care about this at all */ | |
49 | #ifdef DEBUG_PARSER | |
f10fec81 | 50 | #undef dbg_parse |
54988802 KS |
51 | #define dbg_parse(format, arg...) \ |
52 | do { \ | |
53 | log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ | |
54 | } while (0) | |
54988802 KS |
55 | #endif |
56 | ||
f10fec81 | 57 | #endif /* LOG */ |
54988802 KS |
58 | |
59 | extern int log_message (int level, const char *format, ...) | |
60 | __attribute__ ((format (printf, 2, 3))); | |
61 | ||
62 | #endif |