3 * Purple is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22 #ifndef _PURPLE_DEBUG_H_
23 #define _PURPLE_DEBUG_H_
26 * @section_id: libpurple-debug
27 * @short_description: <filename>debug.h</filename>
32 #include <glib-object.h>
36 #define PURPLE_TYPE_DEBUG_UI_OPS (purple_debug_ui_ops_get_type())
38 typedef struct _PurpleDebugUiOps PurpleDebugUiOps
;
42 * @PURPLE_DEBUG_ALL: All debug levels.
43 * @PURPLE_DEBUG_MISC: General chatter.
44 * @PURPLE_DEBUG_INFO: General operation Information.
45 * @PURPLE_DEBUG_WARNING: Warnings.
46 * @PURPLE_DEBUG_ERROR: Errors.
47 * @PURPLE_DEBUG_FATAL: Fatal errors.
65 * Debug UI operations.
67 struct _PurpleDebugUiOps
69 void (*print
)(PurpleDebugLevel level
, const char *category
,
71 gboolean (*is_enabled
)(PurpleDebugLevel level
,
72 const char *category
);
75 void (*_purple_reserved1
)(void);
76 void (*_purple_reserved2
)(void);
77 void (*_purple_reserved3
)(void);
78 void (*_purple_reserved4
)(void);
83 /**************************************************************************/
85 /**************************************************************************/
88 * @level: The debug level.
89 * @category: The category (or %NULL).
90 * @format: The format string.
92 * Outputs debug information.
94 void purple_debug(PurpleDebugLevel level
, const char *category
,
95 const char *format
, ...) G_GNUC_PRINTF(3, 4);
99 * @category: The category (or %NULL).
100 * @format: The format string.
102 * Outputs misc. level debug information.
104 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_MISC as
107 * See purple_debug().
109 void purple_debug_misc(const char *category
, const char *format
, ...) G_GNUC_PRINTF(2, 3);
113 * @category: The category (or %NULL).
114 * @format: The format string.
116 * Outputs info level debug information.
118 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_INFO as
121 * See purple_debug().
123 void purple_debug_info(const char *category
, const char *format
, ...) G_GNUC_PRINTF(2, 3);
126 * purple_debug_warning:
127 * @category: The category (or %NULL).
128 * @format: The format string.
130 * Outputs warning level debug information.
132 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_WARNING as
135 * See purple_debug().
137 void purple_debug_warning(const char *category
, const char *format
, ...) G_GNUC_PRINTF(2, 3);
140 * purple_debug_error:
141 * @category: The category (or %NULL).
142 * @format: The format string.
144 * Outputs error level debug information.
146 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_ERROR as
149 * See purple_debug().
151 void purple_debug_error(const char *category
, const char *format
, ...) G_GNUC_PRINTF(2, 3);
154 * purple_debug_fatal:
155 * @category: The category (or %NULL).
156 * @format: The format string.
158 * Outputs fatal error level debug information.
160 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_ERROR as
163 * See purple_debug().
165 void purple_debug_fatal(const char *category
, const char *format
, ...) G_GNUC_PRINTF(2, 3);
168 * purple_debug_set_enabled:
169 * @enabled: TRUE to enable debug output or FALSE to disable it.
171 * Enable or disable printing debug output to the console.
173 void purple_debug_set_enabled(gboolean enabled
);
176 * purple_debug_is_enabled:
178 * Check if console debug output is enabled.
180 * Returns: TRUE if debugging is enabled, FALSE if it is not.
182 gboolean
purple_debug_is_enabled(void);
185 * purple_debug_set_verbose:
186 * @verbose: TRUE to enable verbose debugging or FALSE to disable it.
188 * Enable or disable verbose debugging. This ordinarily should only be called
189 * by #purple_debug_init, but there are cases where this can be useful for
192 void purple_debug_set_verbose(gboolean verbose
);
195 * purple_debug_is_verbose:
197 * Check if verbose logging is enabled.
199 * Returns: TRUE if verbose debugging is enabled, FALSE if it is not.
201 gboolean
purple_debug_is_verbose(void);
204 * purple_debug_set_unsafe:
205 * @unsafe: TRUE to enable debug logging of messages that could
206 * potentially contain passwords and other sensitive information.
207 * FALSE to disable it.
209 * Enable or disable unsafe debugging. This ordinarily should only be called
210 * by #purple_debug_init, but there are cases where this can be useful for
213 void purple_debug_set_unsafe(gboolean unsafe
);
216 * purple_debug_is_unsafe:
218 * Check if unsafe debugging is enabled. Defaults to FALSE.
220 * Returns: TRUE if the debug logging of all messages is enabled, FALSE
221 * if messages that could potentially contain passwords and other
222 * sensitive information are not logged.
224 gboolean
purple_debug_is_unsafe(void);
227 * purple_debug_set_colored:
228 * @colored: TRUE to enable colored output, FALSE to disable it.
230 * Enable or disable colored output for bash console.
232 void purple_debug_set_colored(gboolean colored
);
234 /**************************************************************************/
235 /* UI Registration Functions */
236 /**************************************************************************/
239 * purple_debug_ui_ops_get_type:
241 * Returns: The #GType for the #PurpleDebugUiOps boxed structure.
243 GType
purple_debug_ui_ops_get_type(void);
246 * purple_debug_set_ui_ops:
247 * @ops: The UI operations structure.
249 * Sets the UI operations structure to be used when outputting debug
252 void purple_debug_set_ui_ops(PurpleDebugUiOps
*ops
);
255 * purple_debug_get_ui_ops:
257 * Returns the UI operations structure used when outputting debug
260 * Returns: The UI operations structure in use.
262 PurpleDebugUiOps
*purple_debug_get_ui_ops(void);
264 /**************************************************************************/
265 /* Debug Subsystem */
266 /**************************************************************************/
271 * Initializes the debug subsystem.
273 void purple_debug_init(void);
277 #endif /* _PURPLE_DEBUG_H_ */