1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
2  *
3  * Copyright (C) 2007-2011 David Zeuthen <zeuthen@gmail.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  *
19  */
20 
21 #ifndef __UDISKS_LOGGING_H__
22 #define __UDISKS_LOGGING_H__
23 
24 #include "udisksdaemontypes.h"
25 #include "config.h"
26 
27 G_BEGIN_DECLS
28 
29 void udisks_log (UDisksLogLevel   level,
30                  const gchar     *function,
31                  const gchar     *location,
32                  const gchar     *format,
33                  ...) G_GNUC_PRINTF (4, 5);
34 
35 /**
36  * udisks_debug:
37  * @args...: printf()-style format string and arguments
38  *
39  * Logging macro for %UDISKS_LOG_LEVEL_DEBUG.
40  * Warning: ONLY WORKS WHEN COMPILED WITH --enable-debug
41  *
42  * See #UDisksLogLevel for more details.
43  */
44 #ifdef DEBUG
45 #define udisks_debug(args...)   udisks_log(UDISKS_LOG_LEVEL_DEBUG, G_STRFUNC, G_STRLOC, args)
46 #else
47 #define udisks_debug(args...)
48 #endif
49 
50 /**
51  * udisks_info:
52  * @args...: printf()-style format string and arguments
53  *
54  * Logging macro for %UDISKS_LOG_LEVEL_INFO.
55  * Warning: ONLY WORKS WHEN COMPILED WITH --enable-debug
56  *
57  * See #UDisksLogLevel for more details.
58  */
59 #ifdef DEBUG
60 #define udisks_info(args...)    udisks_log(UDISKS_LOG_LEVEL_INFO, G_STRFUNC, G_STRLOC, args)
61 #else
62 #define udisks_info(args...)
63 #endif
64 
65 /**
66  * udisks_notice:
67  * @args...: printf()-style format string and arguments
68  *
69  * Logging macro for %UDISKS_LOG_LEVEL_MESSAGE.
70  *
71  * See #UDisksLogLevel for more details.
72  */
73 #define udisks_notice(args...)    udisks_log(UDISKS_LOG_LEVEL_MESSAGE, G_STRFUNC, G_STRLOC, args)
74 
75 /**
76  * udisks_message:
77  * @args...: printf()-style format string and arguments
78  *
79  * Logging macro for %UDISKS_LOG_LEVEL_MESSAGE.
80  *
81  * See #UDisksLogLevel for more details.
82  */
83 #define udisks_message(args...)    udisks_log(UDISKS_LOG_LEVEL_MESSAGE, G_STRFUNC, G_STRLOC, args)
84 
85 /**
86  * udisks_warning:
87  * @args...: printf()-style format string and arguments
88  *
89  * Logging macro for %UDISKS_LOG_LEVEL_WARNING.
90  *
91  * See #UDisksLogLevel for more details.
92  */
93 #define udisks_warning(args...) udisks_log(UDISKS_LOG_LEVEL_WARNING, G_STRFUNC, G_STRLOC, args)
94 
95 /**
96  * udisks_critical:
97  * @args...: printf()-style format string and arguments
98  *
99  * Logging macro for %UDISKS_LOG_LEVEL_CRITICAL.
100  *
101  * See #UDisksLogLevel for more details.
102  */
103 #define udisks_critical(args...)   udisks_log(UDISKS_LOG_LEVEL_CRITICAL, G_STRFUNC, G_STRLOC, args)
104 
105 /**
106  * udisks_error:
107  * @args...: printf()-style format string and arguments
108  *
109  * Logging macro for %UDISKS_LOG_LEVEL_ERROR.
110  * Warning: THIS ALSO TERMINATES THE PROCESS with the abort() call!
111  *
112  * See #UDisksLogLevel for more details.
113  */
114 #define udisks_error(args...)   udisks_log(UDISKS_LOG_LEVEL_ERROR, G_STRFUNC, G_STRLOC, args)
115 
116 
117 G_END_DECLS
118 
119 #endif /* __UDISKS_LOGGING_H__ */
120