1 /* libmpd (high level libmpdclient library) 2 * Copyright (C) 2004-2009 Qball Cow <qball@sarine.nl> 3 * Project homepage: http://gmpcwiki.sarine.nl/ 4 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. 9 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. 14 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. 18 */ 19 20 #ifndef __DEBUG_PRINTF_H__ 21 #define __DEBUG_PRINTF_H__ 22 23 /**\defgroup 100debug Debug 24 */ 25 /*@{*/ 26 27 /** 28 */ 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; 39 40 /** 41 * @param dl a #DebugLevel 42 * 43 * Set the debug level. if set to DEBUG_INFO everything is printed to stdout. 44 */ 45 void debug_set_level(DebugLevel dl); 46 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,...); 49 50 /** 51 * @param dp The debug level the message is at. 52 * @param format a printf style string 53 * @param ARGS arguments for format 54 */ 55 #define debug_printf(dp, format, ARGS...) debug_printf_real(dp,__FILE__,__LINE__,__FUNCTION__,format,##ARGS) 56 57 /** 58 * @param fp a #FILE 59 * 60 * Redirect the output from stdout to fp. 61 * Set to NULL, to revert back to stdout. 62 */ 63 void debug_set_output(FILE *fp); 64 /*@}*/ 65 #endif 66