whatever
[libmpd.git] / src / debug_printf.h
blob05f1cc16056eb9d547e4c6563f5bb38983a12d19
1 /* libmpd (high level libmpdclient library)
2 * Copyright (C) 2004-2009 Qball Cow <qball@sarine.nl>
3 * Project homepage: http://gmpcwiki.sarine.nl/
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
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 along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef __DEBUG_PRINTF_H__
21 #define __DEBUG_PRINTF_H__
23 /**\defgroup 100debug Debug
25 /*@{*/
27 /**
29 typedef enum _DebugLevel {
30 /** No debug output */
31 DEBUG_NO_OUTPUT = 0,
32 /** Print only error messages */
33 DEBUG_ERROR = 1,
34 /** Print Error and Warning messages */
35 DEBUG_WARNING = 2,
36 /** Print only error message */
37 DEBUG_INFO = 3
38 } DebugLevel;
40 /**
41 * @param dl a #DebugLevel
43 * Set the debug level. if set to DEBUG_INFO everything is printed to stdout.
45 void debug_set_level(DebugLevel dl);
47 /** Internal function, do no use */
48 void debug_printf_real(DebugLevel dp, const char *file,const int line,const char *function, const char *format,...);
50 /**
51 * @param dp The debug level the message is at.
52 * @param format a printf style string
53 * @param ARGS arguments for format
55 #define debug_printf(dp, format, ARGS...) debug_printf_real(dp,__FILE__,__LINE__,__FUNCTION__,format,##ARGS)
57 /**
58 * @param fp a #FILE
60 * Redirect the output from stdout to fp.
61 * Set to NULL, to revert back to stdout.
63 void debug_set_output(FILE *fp);
64 /*@}*/
65 #endif