2 * @file debug.h Debug API
8 * Purple is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 #ifndef _PURPLE_DEBUG_H_
27 #define _PURPLE_DEBUG_H_
37 PURPLE_DEBUG_ALL
= 0, /**< All debug levels. */
38 PURPLE_DEBUG_MISC
, /**< General chatter. */
39 PURPLE_DEBUG_INFO
, /**< General operation Information. */
40 PURPLE_DEBUG_WARNING
, /**< Warnings. */
41 PURPLE_DEBUG_ERROR
, /**< Errors. */
42 PURPLE_DEBUG_FATAL
/**< Fatal errors. */
47 * Debug UI operations.
51 void (*print
)(PurpleDebugLevel level
, const char *category
,
53 gboolean (*is_enabled
)(PurpleDebugLevel level
,
54 const char *category
);
56 void (*_purple_reserved1
)(void);
57 void (*_purple_reserved2
)(void);
58 void (*_purple_reserved3
)(void);
59 void (*_purple_reserved4
)(void);
66 /**************************************************************************/
67 /** @name Debug API */
68 /**************************************************************************/
70 * Outputs debug information.
72 * @param level The debug level.
73 * @param category The category (or @c NULL).
74 * @param format The format string.
76 void purple_debug(PurpleDebugLevel level
, const char *category
,
77 const char *format
, ...) G_GNUC_PRINTF(3, 4);
80 * Outputs misc. level debug information.
82 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_MISC as
85 * @param category The category (or @c NULL).
86 * @param format The format string.
90 void purple_debug_misc(const char *category
, const char *format
, ...) G_GNUC_PRINTF(2, 3);
93 * Outputs info level debug information.
95 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_INFO as
98 * @param category The category (or @c NULL).
99 * @param format The format string.
101 * @see purple_debug()
103 void purple_debug_info(const char *category
, const char *format
, ...) G_GNUC_PRINTF(2, 3);
106 * Outputs warning level debug information.
108 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_WARNING as
111 * @param category The category (or @c NULL).
112 * @param format The format string.
114 * @see purple_debug()
116 void purple_debug_warning(const char *category
, const char *format
, ...) G_GNUC_PRINTF(2, 3);
119 * Outputs error level debug information.
121 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_ERROR as
124 * @param category The category (or @c NULL).
125 * @param format The format string.
127 * @see purple_debug()
129 void purple_debug_error(const char *category
, const char *format
, ...) G_GNUC_PRINTF(2, 3);
132 * Outputs fatal error level debug information.
134 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_ERROR as
137 * @param category The category (or @c NULL).
138 * @param format The format string.
140 * @see purple_debug()
142 void purple_debug_fatal(const char *category
, const char *format
, ...) G_GNUC_PRINTF(2, 3);
145 * Enable or disable printing debug output to the console.
147 * @param enabled TRUE to enable debug output or FALSE to disable it.
149 void purple_debug_set_enabled(gboolean enabled
);
152 * Check if console debug output is enabled.
154 * @return TRUE if debugging is enabled, FALSE if it is not.
156 gboolean
purple_debug_is_enabled(void);
159 * Enable or disable verbose debugging. This ordinarily should only be called
160 * by #purple_debug_init, but there are cases where this can be useful for
163 * @param verbose TRUE to enable verbose debugging or FALSE to disable it.
167 void purple_debug_set_verbose(gboolean verbose
);
170 * Check if verbose logging is enabled.
172 * @return TRUE if verbose debugging is enabled, FALSE if it is not.
176 gboolean
purple_debug_is_verbose(void);
179 * Enable or disable verbose debugging. This ordinarily should only be called
180 * by #purple_debug_init, but there are cases where this can be useful for
183 * @param unsafe TRUE to enable verbose debugging or FALSE to disable it.
187 void purple_debug_set_unsafe(gboolean unsafe
);
190 * Check if unsafe debugging is enabled.
192 * @return TRUE if verbose debugging is enabled, FALSE if it is not.
196 gboolean
purple_debug_is_unsafe(void);
200 /**************************************************************************/
201 /** @name UI Registration Functions */
202 /**************************************************************************/
206 * Sets the UI operations structure to be used when outputting debug
209 * @param ops The UI operations structure.
211 void purple_debug_set_ui_ops(PurpleDebugUiOps
*ops
);
214 * Returns the UI operations structure used when outputting debug
217 * @return The UI operations structure in use.
219 PurpleDebugUiOps
*purple_debug_get_ui_ops(void);
223 /**************************************************************************/
224 /** @name Debug Subsystem */
225 /**************************************************************************/
229 * Initializes the debug subsystem.
231 void purple_debug_init(void);
239 #endif /* _PURPLE_DEBUG_H_ */