1 /* 2 * xapp-debug: debug loggers for xapp 3 * 4 * Copyright (C) 2007 Collabora Ltd. 5 * Copyright (C) 2007 Nokia Corporation 6 * Copyright (C) 2010 Red Hat, Inc. 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public 10 * License as published by the Free Software Foundation; either 11 * version 2.1 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 21 * 22 * Copied from nemo 23 */ 24 25 #ifndef __XAPP_DEBUG_H__ 26 #define __XAPP_DEBUG_H__ 27 28 #include <config.h> 29 #include <glib.h> 30 31 G_BEGIN_DECLS 32 33 typedef enum 34 { 35 XAPP_DEBUG_WINDOW = 1 << 1, 36 XAPP_DEBUG_FAVORITES = 1 << 2, 37 XAPP_DEBUG_FAVORITE_VFS = 1 << 3, 38 XAPP_DEBUG_STATUS_ICON = 1 << 4, 39 XAPP_DEBUG_SN_WATCHER = 1 << 5, 40 XAPP_DEBUG_MODULE = 1 << 6 41 } DebugFlags; 42 43 void xapp_debug_set_flags (DebugFlags flags); 44 gboolean xapp_debug_flag_is_set (DebugFlags flag); 45 46 void xapp_debug_valist (DebugFlags flag, 47 const gchar *format, va_list args); 48 49 void xapp_debug (DebugFlags flag, const gchar *format, ...) 50 G_GNUC_PRINTF (2, 3); 51 52 #ifdef DEBUG_FLAG 53 54 #define DEBUG(format, ...) \ 55 xapp_debug (DEBUG_FLAG, "%s: %s: " format, G_STRFUNC, G_STRLOC, \ 56 ##__VA_ARGS__) 57 58 #define DEBUGGING xapp_debug_flag_is_set(DEBUG_FLAG) 59 60 #endif /* DEBUG_FLAG */ 61 62 #else /* ENABLE_DEBUG */ 63 64 #ifdef DEBUG_FLAG 65 66 #define DEBUG(format, ...) \ 67 G_STMT_START { } G_STMT_END 68 69 #define DEBUGGING 0 70 71 #endif /* DEBUG_FLAG */ 72 73 G_END_DECLS 74 75 #endif /* __XAPP_DEBUG_H__ */ 76