upgrade waf to 2.1.2
[gmidimonitor.git] / log.h
blobcec29ee93720fb3421badc669f6b3493f15f3a7d
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*****************************************************************************
4 * This file is part of gmidimonitor
6 * Copyright (C) 2006,2007,2008,2011 Nedko Arnaudov <nedko@arnaudov.name>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *****************************************************************************/
23 #ifndef LOG_H__7097F6FE_4FEE_4962_9542_60375961F567__INCLUDED
24 #define LOG_H__7097F6FE_4FEE_4962_9542_60375961F567__INCLUDED
26 void log_msg(int level, const char * format, ...);
28 #define LOG_LEVEL_DEBUG 0
29 #define LOG_LEVEL_INFO 1
30 #define LOG_LEVEL_WARNING 2
31 #define LOG_LEVEL_NOTICE 3
32 #define LOG_LEVEL_ERROR 4
33 #define LOG_LEVEL_FATAL 5
34 #define LOG_LEVEL_BLACK_HOLE 6
36 #if !defined(LOG_LEVEL)
37 #define LOG_LEVEL LOG_LEVEL_WARNING
38 #endif
40 #if LOG_LEVEL <= LOG_LEVEL_DEBUG
41 # define LOG_DEBUG(format, arg...) \
42 log_msg(LOG_LEVEL_DEBUG, \
43 format "\n", ## arg)
44 #else
45 # define LOG_DEBUG(format, arg...)
46 #endif
48 #if LOG_LEVEL <= LOG_LEVEL_INFO
49 # define LOG_INFO(format, arg...) \
50 log_msg(LOG_LEVEL_INFO, \
51 format "\n", ## arg)
52 #else
53 # define LOG_INFO(format, arg...)
54 #endif
56 #if LOG_LEVEL <= LOG_LEVEL_WARNING
57 # define LOG_WARNING(format, arg...) \
58 log_msg(LOG_LEVEL_WARNING, \
59 format "\n", ## arg)
60 #else
61 # define LOG_WARNING(format, arg...)
62 #endif
64 #if LOG_LEVEL <= LOG_LEVEL_NOTICE
65 # define LOG_NOTICE(format, arg...) \
66 log_msg(LOG_LEVEL_NOTICE, \
67 format "\n", ## arg)
68 #else
69 # define LOG_NOTICE(format, arg...)
70 #endif
72 #if LOG_LEVEL <= LOG_LEVEL_ERROR
73 # define LOG_ERROR(format, arg...) \
74 log_msg(LOG_LEVEL_ERROR, \
75 format "\n", ## arg)
76 #else
77 # define LOG_ERROR(format, arg...)
78 #endif
80 #if LOG_LEVEL <= LOG_LEVEL_FATAL
81 # define LOG_FATAL(format, arg...) \
82 log_msg(LOG_LEVEL_FATAL, \
83 format "\n", ## arg)
84 #else
85 # define LOG_FATAL(format, arg...)
86 #endif
88 #endif /* #ifndef LOG_H__7097F6FE_4FEE_4962_9542_60375961F567__INCLUDED */