Merging upstream version 0.7.0 (Closes: #493243, #510888, #567617, #699414, #709777...
[debian/lxpanel.git] / plugins / weather / logutil.h
1 /**
2 * Copyright (c) 2012-2014 Piotr Sipika; see the AUTHORS file for more.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * See the COPYRIGHT file for more information.
19 */
20
21 #ifndef LXWEATHER_LOGUTIL_HEADER
22 #define LXWEATHER_LOGUTIL_HEADER
23
24 /**
25 * Log Levels
26 */
27 typedef enum
28 {
29 LXW_NONE = 0,
30 LXW_ERROR,
31 LXW_DEBUG,
32 LXW_VERBOSE,
33 LXW_ALL
34 } LXWEATHER_LOGLEVEL;
35
36 /**
37 * Initializes the logging subsystem
38 *
39 * @param pczPath Path to a file to log to (can be NULL for std{out|err},
40 * or 'syslog' for syslog)
41 */
42 void initializeLogUtil(const char * pczPath);
43
44 /**
45 * Cleans up the logging subsystem
46 *
47 */
48 void cleanupLogUtil();
49
50 /**
51 * Logs the message using the specified level.
52 *
53 * @param level The level to log at
54 * @param pczMsg Message to log
55 */
56 void logUtil(LXWEATHER_LOGLEVEL level, const char * pczMsg, ...);
57
58 /**
59 * Sets the maximum allowed log level
60 *
61 * @param level The level to use for all messages to follow.
62 *
63 * @return Previous value of the maximum log level.
64 */
65 LXWEATHER_LOGLEVEL setMaxLogLevel(LXWEATHER_LOGLEVEL level);
66
67 #ifdef DEBUG
68 #define LXW_LOG(level, fmt, args...) logUtil(level, fmt, ##args)
69 #else
70 #define LXW_LOG(level, fmt, args...)
71 #endif
72
73 #endif