getdetune() coding style cleanup
[zyn.git] / log.h
blobd6b485d357f35d024c27de71724a8048a760dcaa
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*****************************************************************************
4 * Copyright (C) 2006,2007,2008,2009 Nedko Arnaudov <nedko@arnaudov.name>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License
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.
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.
19 *****************************************************************************/
21 #ifndef LOG_H__7097F6FE_4FEE_4962_9542_60375961F567__INCLUDED
22 #define LOG_H__7097F6FE_4FEE_4962_9542_60375961F567__INCLUDED
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 #if 0
28 } /* Adjust editor indent */
29 #endif
31 void zyn_log(int level, const char * format, ...);
33 #if 0
34 { /* Adjust editor indent */
35 #endif
36 #ifdef __cplusplus
37 } /* extern "C" */
38 #endif
40 #define LOG_LEVEL_DEBUG 0
41 #define LOG_LEVEL_INFO 1
42 #define LOG_LEVEL_WARNING 2
43 #define LOG_LEVEL_NOTICE 3
44 #define LOG_LEVEL_ERROR 4
45 #define LOG_LEVEL_FATAL 5
46 #define LOG_LEVEL_BLACK_HOLE 6
48 #if !defined(LOG_LEVEL)
49 #define LOG_LEVEL LOG_LEVEL_WARNING
50 #endif
52 #if LOG_LEVEL <= LOG_LEVEL_DEBUG
53 # define LOG_DEBUG(format, arg...) \
54 zyn_log(LOG_LEVEL_DEBUG, \
55 format "\n", ## arg)
56 #else
57 # define LOG_DEBUG(format, arg...)
58 #endif
60 #if LOG_LEVEL <= LOG_LEVEL_INFO
61 # define LOG_INFO(format, arg...) \
62 zyn_log(LOG_LEVEL_INFO, \
63 format "\n", ## arg)
64 #else
65 # define LOG_INFO(format, arg...)
66 #endif
68 #if LOG_LEVEL <= LOG_LEVEL_WARNING
69 # define LOG_WARNING(format, arg...) \
70 zyn_log(LOG_LEVEL_WARNING, \
71 format "\n", ## arg)
72 #else
73 # define LOG_WARNING(format, arg...)
74 #endif
76 #if LOG_LEVEL <= LOG_LEVEL_NOTICE
77 # define LOG_NOTICE(format, arg...) \
78 zyn_log(LOG_LEVEL_NOTICE, \
79 format "\n", ## arg)
80 #else
81 # define LOG_NOTICE(format, arg...)
82 #endif
84 #if LOG_LEVEL <= LOG_LEVEL_ERROR
85 # define LOG_ERROR(format, arg...) \
86 zyn_log(LOG_LEVEL_ERROR, \
87 format "\n", ## arg)
88 #else
89 # define LOG_ERROR(format, arg...)
90 #endif
92 #if LOG_LEVEL <= LOG_LEVEL_FATAL
93 # define LOG_FATAL(format, arg...) \
94 zyn_log(LOG_LEVEL_FATAL, \
95 format "\n", ## arg)
96 #else
97 # define LOG_FATAL(format, arg...)
98 #endif
100 #endif /* #ifndef LOG_H__7097F6FE_4FEE_4962_9542_60375961F567__INCLUDED */