Fix some functions descriptions
[pidgin-git.git] / libpurple / debug.h
blob6b9d853cda90459e2ef1cccbd560a53f9a832617
1 /* purple
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
5 * source distribution.
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_
24 /**
25 * SECTION:debug
26 * @section_id: libpurple-debug
27 * @short_description: <filename>debug.h</filename>
28 * @title: Debug API
31 #include <glib.h>
32 #include <glib-object.h>
34 #include <stdarg.h>
36 #define PURPLE_TYPE_DEBUG_UI_OPS (purple_debug_ui_ops_get_type())
38 typedef struct _PurpleDebugUiOps PurpleDebugUiOps;
40 /**
41 * PurpleDebugLevel:
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.
49 * Debug levels.
51 typedef enum
53 PURPLE_DEBUG_ALL = 0,
54 PURPLE_DEBUG_MISC,
55 PURPLE_DEBUG_INFO,
56 PURPLE_DEBUG_WARNING,
57 PURPLE_DEBUG_ERROR,
58 PURPLE_DEBUG_FATAL
60 } PurpleDebugLevel;
62 /**
63 * PurpleDebugUiOps:
65 * Debug UI operations.
67 struct _PurpleDebugUiOps
69 void (*print)(PurpleDebugLevel level, const char *category,
70 const char *arg_s);
71 gboolean (*is_enabled)(PurpleDebugLevel level,
72 const char *category);
74 /*< private >*/
75 void (*_purple_reserved1)(void);
76 void (*_purple_reserved2)(void);
77 void (*_purple_reserved3)(void);
78 void (*_purple_reserved4)(void);
81 G_BEGIN_DECLS
83 /**************************************************************************/
84 /* Debug API */
85 /**************************************************************************/
86 /**
87 * purple_debug:
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);
97 /**
98 * purple_debug_misc:
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
105 * the level.
107 * See purple_debug().
109 void purple_debug_misc(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3);
112 * purple_debug_info:
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
119 * the level.
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
133 * the level.
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
147 * the level.
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
161 * the level.
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
190 * plugins.
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
211 * plugins.
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
250 * information.
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
258 * information.
260 * Returns: The UI operations structure in use.
262 PurpleDebugUiOps *purple_debug_get_ui_ops(void);
264 /**************************************************************************/
265 /* Debug Subsystem */
266 /**************************************************************************/
269 * purple_debug_init:
271 * Initializes the debug subsystem.
273 void purple_debug_init(void);
275 G_END_DECLS
277 #endif /* _PURPLE_DEBUG_H_ */