Remove unused Meson option for enchant.
[pidgin-git.git] / libpurple / debug.h
blob7a43d31e3a74bfa6b88cac841c8f4ed149427757
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 G_BEGIN_DECLS
38 #define PURPLE_TYPE_DEBUG_UI (purple_debug_ui_get_type())
39 G_DECLARE_INTERFACE(PurpleDebugUi, purple_debug_ui, PURPLE, DEBUG_UI, GObject)
41 /**
42 * PurpleDebugLevel:
43 * @PURPLE_DEBUG_ALL: All debug levels.
44 * @PURPLE_DEBUG_MISC: General chatter.
45 * @PURPLE_DEBUG_INFO: General operation Information.
46 * @PURPLE_DEBUG_WARNING: Warnings.
47 * @PURPLE_DEBUG_ERROR: Errors.
48 * @PURPLE_DEBUG_FATAL: Fatal errors.
50 * Debug levels.
52 typedef enum
54 PURPLE_DEBUG_ALL = 0,
55 PURPLE_DEBUG_MISC,
56 PURPLE_DEBUG_INFO,
57 PURPLE_DEBUG_WARNING,
58 PURPLE_DEBUG_ERROR,
59 PURPLE_DEBUG_FATAL
61 } PurpleDebugLevel;
63 /**
64 * PurpleDebugUiInterface:
66 * Debug UI operations.
68 struct _PurpleDebugUiInterface
70 GTypeInterface parent_iface;
72 void (*print)(PurpleDebugUi *self,
73 PurpleDebugLevel level, const char *category,
74 const char *arg_s);
75 gboolean (*is_enabled)(PurpleDebugUi *self,
76 PurpleDebugLevel level,
77 const char *category);
79 /*< private >*/
80 void (*_purple_reserved1)(PurpleDebugUi *self);
81 void (*_purple_reserved2)(PurpleDebugUi *self);
82 void (*_purple_reserved3)(PurpleDebugUi *self);
83 void (*_purple_reserved4)(PurpleDebugUi *self);
86 /**************************************************************************/
87 /* Debug API */
88 /**************************************************************************/
89 /**
90 * purple_debug:
91 * @level: The debug level.
92 * @category: The category (or %NULL).
93 * @format: The format string.
94 * @...: The parameters to insert into the format string.
96 * Outputs debug information.
98 void purple_debug(PurpleDebugLevel level, const char *category,
99 const char *format, ...) G_GNUC_PRINTF(3, 4);
102 * purple_debug_misc:
103 * @category: The category (or %NULL).
104 * @format: The format string.
105 * @...: The parameters to insert into the format string.
107 * Outputs misc. level debug information.
109 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_MISC as
110 * the level.
112 * See purple_debug().
114 void purple_debug_misc(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3);
117 * purple_debug_info:
118 * @category: The category (or %NULL).
119 * @format: The format string.
120 * @...: The parameters to insert into the format string.
122 * Outputs info level debug information.
124 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_INFO as
125 * the level.
127 * See purple_debug().
129 void purple_debug_info(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3);
132 * purple_debug_warning:
133 * @category: The category (or %NULL).
134 * @format: The format string.
135 * @...: The parameters to insert into the format string.
137 * Outputs warning level debug information.
139 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_WARNING as
140 * the level.
142 * See purple_debug().
144 void purple_debug_warning(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3);
147 * purple_debug_error:
148 * @category: The category (or %NULL).
149 * @format: The format string.
150 * @...: The parameters to insert into the format string.
152 * Outputs error level debug information.
154 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_ERROR as
155 * the level.
157 * See purple_debug().
159 void purple_debug_error(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3);
162 * purple_debug_fatal:
163 * @category: The category (or %NULL).
164 * @format: The format string.
165 * @...: The parameters to insert into the format string.
167 * Outputs fatal error level debug information.
169 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_ERROR as
170 * the level.
172 * See purple_debug().
174 void purple_debug_fatal(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3);
177 * purple_debug_set_enabled:
178 * @enabled: TRUE to enable debug output or FALSE to disable it.
180 * Enable or disable printing debug output to the console.
182 void purple_debug_set_enabled(gboolean enabled);
185 * purple_debug_is_enabled:
187 * Check if console debug output is enabled.
189 * Returns: TRUE if debugging is enabled, FALSE if it is not.
191 gboolean purple_debug_is_enabled(void);
194 * purple_debug_set_verbose:
195 * @verbose: TRUE to enable verbose debugging or FALSE to disable it.
197 * Enable or disable verbose debugging. This ordinarily should only be called
198 * by #purple_debug_init, but there are cases where this can be useful for
199 * plugins.
201 void purple_debug_set_verbose(gboolean verbose);
204 * purple_debug_is_verbose:
206 * Check if verbose logging is enabled.
208 * Returns: TRUE if verbose debugging is enabled, FALSE if it is not.
210 gboolean purple_debug_is_verbose(void);
213 * purple_debug_set_unsafe:
214 * @unsafe: TRUE to enable debug logging of messages that could
215 * potentially contain passwords and other sensitive information.
216 * FALSE to disable it.
218 * Enable or disable unsafe debugging. This ordinarily should only be called
219 * by #purple_debug_init, but there are cases where this can be useful for
220 * plugins.
222 void purple_debug_set_unsafe(gboolean unsafe);
225 * purple_debug_is_unsafe:
227 * Check if unsafe debugging is enabled. Defaults to FALSE.
229 * Returns: TRUE if the debug logging of all messages is enabled, FALSE
230 * if messages that could potentially contain passwords and other
231 * sensitive information are not logged.
233 gboolean purple_debug_is_unsafe(void);
236 * purple_debug_set_colored:
237 * @colored: TRUE to enable colored output, FALSE to disable it.
239 * Enable or disable colored output for bash console.
241 void purple_debug_set_colored(gboolean colored);
243 /**************************************************************************/
244 /* UI Registration Functions */
245 /**************************************************************************/
248 * purple_debug_set_ui:
249 * @ops: The UI operations structure.
251 * Sets the UI operations structure to be used when outputting debug
252 * information.
254 void purple_debug_set_ui(PurpleDebugUi *ops);
257 * purple_debug_get_ui:
259 * Returns the UI operations structure used when outputting debug
260 * information.
262 * Returns: (transfer none): The UI operations structure in use.
264 PurpleDebugUi *purple_debug_get_ui(void);
266 /**************************************************************************/
267 /* Debug Subsystem */
268 /**************************************************************************/
271 * purple_debug_init:
273 * Initializes the debug subsystem.
275 void purple_debug_init(void);
277 G_END_DECLS
279 #endif /* PURPLE_DEBUG_H */