3
* @brief internal GEIS debug/logging facilities
5
* Copyright 2010 Canonical Ltd.
7
* This library is free software; you can redistribute it and/or modify it under
8
* the terms of the GNU Lesser General Public License as published by the Free
9
* Software Foundation; either version 3 of the License, or (at your option) any
12
* This library is distributed in the hope that it will be useful, but WITHOUT
13
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17
* You should have received a copy of the GNU Lesser General Public License
18
* along with this program; if not, write to the Free Software Foundation, Inc.,
19
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
#ifndef GEIS_LOGGING_H_
22
#define GEIS_LOGGING_H_
25
* @defgroup geis_logging GEIS Logging Facilities
27
* This facility allows the run-time delivery of debugging and error emssages
28
* from the library. By default, no debug or error diagnostics are emitted by
29
* the library. However, if the environment variable GEIS_DEBUG is set to an
30
* appropriate value, these diagnostic messages will be emitted to stderr.
32
* The following GEIS_DEBUG values are supported.
34
* GEIS_DEBUG=1 error messages only are emitted
35
* GEIS_DEBUG=2 error and warning messages are emitted
36
* GEIS_DEBUG=3 error, warning, and debug messages are emitted
41
#define _GEIS_LOG_LEVEL_ERROR 1
42
#define _GEIS_LOG_LEVEL_WARNING 2
43
#define _GEIS_LOG_LEVEL_DEBUG 3
46
* Emits a message at the DEBUG logging level.
47
* @param[in] fmt printf-style format string
49
#define geis_debug(...) _geis_message(_GEIS_LOG_LEVEL_DEBUG, \
50
__FUNCTION__, __LINE__, \
52
#define geis_warning(...) _geis_message(_GEIS_LOG_LEVEL_WARNING, \
53
__FUNCTION__, __LINE__, \
55
#define geis_error(...) _geis_message(_GEIS_LOG_LEVEL_ERROR, \
56
__FUNCTION__, __LINE__, \
58
int _geis_message(int level,
59
const char *function, int line,
60
const char *format, ...) __attribute__((format(printf, 4, 5)));
64
#endif /* GEIS_LOGGING_H_ */