1 /*
2  * nautilus-debug: debug loggers for nautilus
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, see <http://www.gnu.org/licenses/>.
20  *
21  * Based on Empathy's empathy-debug.
22  */
23 
24 #pragma once
25 
26 #include <config.h>
27 #include <glib.h>
28 
29 G_BEGIN_DECLS
30 
31 typedef enum {
32   NAUTILUS_DEBUG_APPLICATION = 1 << 1,
33   NAUTILUS_DEBUG_ASYNC_JOBS = 1 << 2,
34   NAUTILUS_DEBUG_BOOKMARKS = 1 << 3,
35   NAUTILUS_DEBUG_DBUS = 1 << 4,
36   NAUTILUS_DEBUG_DIRECTORY_VIEW = 1 << 5,
37   NAUTILUS_DEBUG_FILE = 1 << 6,
38   NAUTILUS_DEBUG_CANVAS_CONTAINER = 1 << 7,
39   NAUTILUS_DEBUG_CANVAS_VIEW = 1 << 8,
40   NAUTILUS_DEBUG_LIST_VIEW = 1 << 9,
41   NAUTILUS_DEBUG_MIME = 1 << 10,
42   NAUTILUS_DEBUG_PLACES = 1 << 11,
43   NAUTILUS_DEBUG_PREVIEWER = 1 << 12,
44   NAUTILUS_DEBUG_SMCLIENT = 1 << 13,
45   NAUTILUS_DEBUG_WINDOW = 1 << 14,
46   NAUTILUS_DEBUG_UNDO = 1 << 15,
47   NAUTILUS_DEBUG_SEARCH = 1 << 16,
48   NAUTILUS_DEBUG_SEARCH_HIT = 1 << 17,
49   NAUTILUS_DEBUG_THUMBNAILS = 1 << 18,
50   NAUTILUS_DEBUG_TAG_MANAGER = 1 << 19,
51 } DebugFlags;
52 
53 void nautilus_debug_set_flags (DebugFlags flags);
54 gboolean nautilus_debug_flag_is_set (DebugFlags flag);
55 
56 void nautilus_debug_valist (DebugFlags flag,
57                             const gchar *format, va_list args);
58 
59 void nautilus_debug (DebugFlags flag, const gchar *format, ...)
60   G_GNUC_PRINTF (2, 3);
61 
62 void nautilus_debug_files (DebugFlags flag, GList *files,
63                            const gchar *format, ...) G_GNUC_PRINTF (3, 4);
64 
65 #ifdef DEBUG_FLAG
66 
67 #define DEBUG(format, ...) \
68   nautilus_debug (DEBUG_FLAG, "%s: %s: " format, G_STRFUNC, G_STRLOC, \
69                   ##__VA_ARGS__)
70 
71 #define DEBUG_FILES(files, format, ...) \
72   nautilus_debug_files (DEBUG_FLAG, files, "%s:" format, G_STRFUNC, \
73                         ##__VA_ARGS__)
74 
75 #define DEBUGGING nautilus_debug_flag_is_set(DEBUG_FLAG)
76 
77 #endif /* DEBUG_FLAG */
78 
79 G_END_DECLS
80