Frameworks/libpurple.framework/Versions/0.6.2/Headers/debug.h
author Zachary West <zacw@adium.im>
Fri Aug 21 13:25:11 2009 -0700 (2009-08-21)
changeset 2592 e8d15275025e
parent 2535 Frameworks/libpurple.framework/Versions/0.6.0/Headers/debug.h@39c3c161de14
permissions -rw-r--r--
im.pidgin.adium.1-4 at 267c6165e02e34318a1823960bd04c0639952f73
Evan@653
     1
/**
Evan@653
     2
 * @file debug.h Debug API
Evan@653
     3
 * @ingroup core
Evan@653
     4
 */
Evan@653
     5
Evan@653
     6
/* purple
Evan@653
     7
 *
Evan@653
     8
 * Purple is the legal property of its developers, whose names are too numerous
Evan@653
     9
 * to list here.  Please refer to the COPYRIGHT file distributed with this
Evan@653
    10
 * source distribution.
Evan@653
    11
 *
Evan@653
    12
 * This program is free software; you can redistribute it and/or modify
Evan@653
    13
 * it under the terms of the GNU General Public License as published by
Evan@653
    14
 * the Free Software Foundation; either version 2 of the License, or
Evan@653
    15
 * (at your option) any later version.
Evan@653
    16
 *
Evan@653
    17
 * This program is distributed in the hope that it will be useful,
Evan@653
    18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Evan@653
    19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Evan@653
    20
 * GNU General Public License for more details.
Evan@653
    21
 *
Evan@653
    22
 * You should have received a copy of the GNU General Public License
Evan@653
    23
 * along with this program; if not, write to the Free Software
Evan@653
    24
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
Evan@653
    25
 */
Evan@653
    26
#ifndef _PURPLE_DEBUG_H_
Evan@653
    27
#define _PURPLE_DEBUG_H_
Evan@653
    28
Evan@653
    29
#include <glib.h>
Evan@653
    30
#include <stdarg.h>
Evan@653
    31
Evan@653
    32
/**
Evan@653
    33
 * Debug levels.
Evan@653
    34
 */
Evan@653
    35
typedef enum
Evan@653
    36
{
Evan@653
    37
	PURPLE_DEBUG_ALL = 0,  /**< All debug levels.              */
Evan@653
    38
	PURPLE_DEBUG_MISC,     /**< General chatter.               */
Evan@653
    39
	PURPLE_DEBUG_INFO,     /**< General operation Information. */
Evan@653
    40
	PURPLE_DEBUG_WARNING,  /**< Warnings.                      */
Evan@653
    41
	PURPLE_DEBUG_ERROR,    /**< Errors.                        */
Evan@653
    42
	PURPLE_DEBUG_FATAL     /**< Fatal errors.                  */
Evan@653
    43
Evan@653
    44
} PurpleDebugLevel;
Evan@653
    45
Evan@653
    46
/**
Evan@653
    47
 * Debug UI operations.
Evan@653
    48
 */
Evan@653
    49
typedef struct
Evan@653
    50
{
Evan@653
    51
	void (*print)(PurpleDebugLevel level, const char *category,
Evan@653
    52
				  const char *arg_s);
Evan@653
    53
	gboolean (*is_enabled)(PurpleDebugLevel level,
Evan@653
    54
			const char *category);
Evan@653
    55
Evan@653
    56
	void (*_purple_reserved1)(void);
Evan@653
    57
	void (*_purple_reserved2)(void);
Evan@653
    58
	void (*_purple_reserved3)(void);
Evan@653
    59
	void (*_purple_reserved4)(void);
Evan@653
    60
} PurpleDebugUiOps;
Evan@653
    61
Evan@653
    62
#ifdef __cplusplus
Evan@653
    63
extern "C" {
Evan@653
    64
#endif
Evan@653
    65
Evan@653
    66
/**************************************************************************/
Evan@653
    67
/** @name Debug API                                                       */
Evan@653
    68
/**************************************************************************/
Evan@653
    69
/**
Evan@653
    70
 * Outputs debug information.
Evan@653
    71
 *
Evan@653
    72
 * @param level    The debug level.
Evan@653
    73
 * @param category The category (or @c NULL).
Evan@653
    74
 * @param format   The format string.
Evan@653
    75
 */
Evan@653
    76
void purple_debug(PurpleDebugLevel level, const char *category,
Evan@653
    77
				const char *format, ...) G_GNUC_PRINTF(3, 4);
Evan@653
    78
Evan@653
    79
/**
Evan@653
    80
 * Outputs misc. level debug information.
Evan@653
    81
 *
Evan@653
    82
 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_MISC as
Evan@653
    83
 * the level.
Evan@653
    84
 *
Evan@653
    85
 * @param category The category (or @c NULL).
Evan@653
    86
 * @param format   The format string.
Evan@653
    87
 *
Evan@653
    88
 * @see purple_debug()
Evan@653
    89
 */
Evan@653
    90
void purple_debug_misc(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3);
Evan@653
    91
Evan@653
    92
/**
Evan@653
    93
 * Outputs info level debug information.
Evan@653
    94
 *
Evan@653
    95
 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_INFO as
Evan@653
    96
 * the level.
Evan@653
    97
 *
Evan@653
    98
 * @param category The category (or @c NULL).
Evan@653
    99
 * @param format   The format string.
Evan@653
   100
 *
Evan@653
   101
 * @see purple_debug()
Evan@653
   102
 */
Evan@653
   103
void purple_debug_info(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3);
Evan@653
   104
Evan@653
   105
/**
Evan@653
   106
 * Outputs warning level debug information.
Evan@653
   107
 *
Evan@653
   108
 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_WARNING as
Evan@653
   109
 * the level.
Evan@653
   110
 *
Evan@653
   111
 * @param category The category (or @c NULL).
Evan@653
   112
 * @param format   The format string.
Evan@653
   113
 *
Evan@653
   114
 * @see purple_debug()
Evan@653
   115
 */
Evan@653
   116
void purple_debug_warning(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3);
Evan@653
   117
Evan@653
   118
/**
Evan@653
   119
 * Outputs error level debug information.
Evan@653
   120
 *
Evan@653
   121
 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_ERROR as
Evan@653
   122
 * the level.
Evan@653
   123
 *
Evan@653
   124
 * @param category The category (or @c NULL).
Evan@653
   125
 * @param format   The format string.
Evan@653
   126
 *
Evan@653
   127
 * @see purple_debug()
Evan@653
   128
 */
Evan@653
   129
void purple_debug_error(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3);
Evan@653
   130
Evan@653
   131
/**
Evan@653
   132
 * Outputs fatal error level debug information.
Evan@653
   133
 *
Evan@653
   134
 * This is a wrapper for purple_debug(), and uses PURPLE_DEBUG_ERROR as
Evan@653
   135
 * the level.
Evan@653
   136
 *
Evan@653
   137
 * @param category The category (or @c NULL).
Evan@653
   138
 * @param format   The format string.
Evan@653
   139
 *
Evan@653
   140
 * @see purple_debug()
Evan@653
   141
 */
Evan@653
   142
void purple_debug_fatal(const char *category, const char *format, ...) G_GNUC_PRINTF(2, 3);
Evan@653
   143
Evan@653
   144
/**
Evan@653
   145
 * Enable or disable printing debug output to the console.
Evan@653
   146
 *
Evan@653
   147
 * @param enabled TRUE to enable debug output or FALSE to disable it.
Evan@653
   148
 */
Evan@653
   149
void purple_debug_set_enabled(gboolean enabled);
Evan@653
   150
Evan@653
   151
/**
Evan@653
   152
 * Check if console debug output is enabled.
Evan@653
   153
 *
zacw@2535
   154
 * @return TRUE if debugging is enabled, FALSE if it is not.
Evan@653
   155
 */
Evan@653
   156
gboolean purple_debug_is_enabled(void);
Evan@653
   157
zacw@2535
   158
/**
zacw@2535
   159
 * Enable or disable verbose debugging.  This ordinarily should only be called
zacw@2535
   160
 * by #purple_debug_init, but there are cases where this can be useful for
zacw@2535
   161
 * plugins.
zacw@2535
   162
 *
zacw@2535
   163
 * @param verbose TRUE to enable verbose debugging or FALSE to disable it.
zacw@2535
   164
 *
zacw@2535
   165
 * @since 2.6.0
zacw@2535
   166
 */
zacw@2535
   167
void purple_debug_set_verbose(gboolean verbose);
zacw@2535
   168
zacw@2535
   169
/**
zacw@2535
   170
 * Check if verbose logging is enabled.
zacw@2535
   171
 *
zacw@2535
   172
 * @return TRUE if verbose debugging is enabled, FALSE if it is not.
zacw@2535
   173
 *
zacw@2535
   174
 * @since 2.6.0
zacw@2535
   175
 */
zacw@2535
   176
gboolean purple_debug_is_verbose(void);
zacw@2535
   177
zacw@2535
   178
/**
zacw@2535
   179
 * Enable or disable verbose debugging.  This ordinarily should only be called
zacw@2535
   180
 * by #purple_debug_init, but there are cases where this can be useful for
zacw@2535
   181
 * plugins.
zacw@2535
   182
 *
zacw@2535
   183
 * @param unsafe  TRUE to enable verbose debugging or FALSE to disable it.
zacw@2535
   184
 *
zacw@2535
   185
 * @since 2.6.0
zacw@2535
   186
 */
zacw@2535
   187
void purple_debug_set_unsafe(gboolean unsafe);
zacw@2535
   188
zacw@2535
   189
/**
zacw@2535
   190
 * Check if unsafe debugging is enabled.
zacw@2535
   191
 *
zacw@2535
   192
 * @return TRUE if verbose debugging is enabled, FALSE if it is not.
zacw@2535
   193
 *
zacw@2535
   194
 * @since 2.6.0
zacw@2535
   195
 */
zacw@2535
   196
gboolean purple_debug_is_unsafe(void);
zacw@2535
   197
Evan@653
   198
/*@}*/
Evan@653
   199
Evan@653
   200
/**************************************************************************/
Evan@653
   201
/** @name UI Registration Functions                                       */
Evan@653
   202
/**************************************************************************/
Evan@653
   203
/*@{*/
Evan@653
   204
Evan@653
   205
/**
Evan@653
   206
 * Sets the UI operations structure to be used when outputting debug
Evan@653
   207
 * information.
Evan@653
   208
 *
Evan@653
   209
 * @param ops The UI operations structure.
Evan@653
   210
 */
Evan@653
   211
void purple_debug_set_ui_ops(PurpleDebugUiOps *ops);
Evan@653
   212
Evan@653
   213
/**
Evan@653
   214
 * Returns the UI operations structure used when outputting debug
Evan@653
   215
 * information.
Evan@653
   216
 *
Evan@653
   217
 * @return The UI operations structure in use.
Evan@653
   218
 */
Evan@653
   219
PurpleDebugUiOps *purple_debug_get_ui_ops(void);
Evan@653
   220
Evan@653
   221
/*@}*/
Evan@653
   222
Evan@653
   223
/**************************************************************************/
Evan@653
   224
/** @name Debug Subsystem                                                 */
Evan@653
   225
/**************************************************************************/
Evan@653
   226
/*@{*/
Evan@653
   227
Evan@653
   228
/**
Evan@653
   229
 * Initializes the debug subsystem.
Evan@653
   230
 */
Evan@653
   231
void purple_debug_init(void);
Evan@653
   232
Evan@653
   233
/*@}*/
Evan@653
   234
Evan@653
   235
#ifdef __cplusplus
Evan@653
   236
}
Evan@653
   237
#endif
Evan@653
   238
Evan@653
   239
#endif /* _PURPLE_DEBUG_H_ */