Add license files and headers
[navit-package] / navit / debug.h
1 /**
2  * Navit, a modular navigation system.
3  * Copyright (C) 2005-2008 Navit Team
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public License
7  * version 2 as published by the Free Software Foundation.
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 Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA  02110-1301, USA.
18  */
19
20 #ifndef NAVIT_DEBUG_H
21 #define NAVIT_DEBUG_H
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #include <stdarg.h>
28 extern int debug_level;
29 #define dbg_str2(x) #x
30 #define dbg_str1(x) dbg_str2(x)
31 #define dbg_module dbg_str1(MODULE)
32 #define dbg(level,fmt...) ({ if (debug_level >= level) debug_printf(level,dbg_module,strlen(dbg_module),__PRETTY_FUNCTION__, strlen(__PRETTY_FUNCTION__),1,fmt); })
33
34 /* prototypes */
35 void debug_init(const char *program_name);
36 void debug_level_set(const char *name, int level);
37 int debug_level_get(const char *name);
38 void debug_vprintf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap);
39 void debug_printf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, ...);
40 /* end of prototypes */
41
42 #ifdef __cplusplus
43 }
44 #endif
45
46 #endif
47