annotate src/debug.c @ 13651:6776eeaa17f2

[gaim-migrate @ 16052] Fix Coverity CID 52: a 100 byte or so memleak when using Accounts-> Confirm Account for an AIM/ICQ account. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 18 Apr 2006 00:07:15 +0000
parents e1e5462b7d81
children 756c3d7177d9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file debug.c Debug API
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 * @ingroup core
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 *
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 * gaim
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7525
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7525
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7525
diff changeset
9 * source distribution.
6483
565339a6eb86 [gaim-migrate @ 6997]
Christian Hammond <chipx86@chipx86.com>
parents: 5212
diff changeset
10 *
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * (at your option) any later version.
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 *
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * GNU General Public License for more details.
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 *
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 */
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 #include "debug.h"
10307
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
26 #include "internal.h"
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
27 #include "prefs.h"
13104
e1e5462b7d81 [gaim-migrate @ 15466]
Richard Laager <rlaager@wiktel.com>
parents: 11504
diff changeset
28 #include "util.h"
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 static GaimDebugUiOps *debug_ui_ops = NULL;
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31
10307
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
32 /*
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
33 * This determines whether debug info should be written to the
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
34 * console or not.
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
35 *
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
36 * It doesn't make sense to make this a normal Gaim preference
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
37 * because it's a command line option. This will always be FALSE,
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
38 * unless the user explicitly started Gaim with the -d flag.
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
39 * It doesn't matter what this value was the last time Gaim was
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
40 * started, so it doesn't make sense to save it in prefs.
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
41 */
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
42 static gboolean debug_enabled = FALSE;
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
43
11504
921f64947cad [gaim-migrate @ 13749]
Richard Laager <rlaager@wiktel.com>
parents: 11256
diff changeset
44 static void
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 gaim_debug_vargs(GaimDebugLevel level, const char *category,
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 const char *format, va_list args)
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 {
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 GaimDebugUiOps *ops;
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 g_return_if_fail(level != GAIM_DEBUG_ALL);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 g_return_if_fail(format != NULL);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52
10307
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
53 if (debug_enabled) {
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
54 gchar *arg_s, *ts_s;
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
55
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
56 arg_s = g_strdup_vprintf(format, args);
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
57
10448
6a20307ef8dc [gaim-migrate @ 11713]
Mark Doliner <mark@kingant.net>
parents: 10307
diff changeset
58 if ((category != NULL) &&
6a20307ef8dc [gaim-migrate @ 11713]
Mark Doliner <mark@kingant.net>
parents: 10307
diff changeset
59 (gaim_prefs_exists("/core/debug/timestamps")) &&
6a20307ef8dc [gaim-migrate @ 11713]
Mark Doliner <mark@kingant.net>
parents: 10307
diff changeset
60 (gaim_prefs_get_bool("/core/debug/timestamps"))) {
13104
e1e5462b7d81 [gaim-migrate @ 15466]
Richard Laager <rlaager@wiktel.com>
parents: 11504
diff changeset
61 const char *mdate;
10307
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
62
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
63 time_t mtime = time(NULL);
13104
e1e5462b7d81 [gaim-migrate @ 15466]
Richard Laager <rlaager@wiktel.com>
parents: 11504
diff changeset
64 mdate = gaim_utf8_strftime("%H:%M:%S", localtime(&mtime));
10307
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
65 ts_s = g_strdup_printf("(%s) ", mdate);
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
66 } else {
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
67 ts_s = g_strdup("");
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
68 }
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
69
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
70 if (category == NULL)
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
71 g_print("%s%s", ts_s, arg_s);
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
72 else
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
73 g_print("%s%s: %s", ts_s, category, arg_s);
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
74
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
75 g_free(arg_s);
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
76 g_free(ts_s);
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
77 }
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
78
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6721
diff changeset
79 ops = gaim_debug_get_ui_ops();
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 if (ops != NULL && ops->print != NULL)
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 ops->print(level, category, format, args);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 }
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 void
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 gaim_debug(GaimDebugLevel level, const char *category,
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 const char *format, ...)
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 {
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 va_list args;
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91 g_return_if_fail(level != GAIM_DEBUG_ALL);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92 g_return_if_fail(format != NULL);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 va_start(args, format);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95 gaim_debug_vargs(level, category, format, args);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96 va_end(args);
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97 }
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 void
6721
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
100 gaim_debug_misc(const char *category, const char *format, ...)
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
101 {
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
102 va_list args;
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
103
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
104 g_return_if_fail(format != NULL);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
105
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
106 va_start(args, format);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
107 gaim_debug_vargs(GAIM_DEBUG_MISC, category, format, args);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
108 va_end(args);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
109 }
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
110
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
111 void
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
112 gaim_debug_info(const char *category, const char *format, ...)
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
113 {
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
114 va_list args;
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
115
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
116 g_return_if_fail(format != NULL);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
117
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
118 va_start(args, format);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
119 gaim_debug_vargs(GAIM_DEBUG_INFO, category, format, args);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
120 va_end(args);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
121 }
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
122
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
123 void
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
124 gaim_debug_warning(const char *category, const char *format, ...)
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
125 {
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
126 va_list args;
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
127
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
128 g_return_if_fail(format != NULL);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
129
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
130 va_start(args, format);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
131 gaim_debug_vargs(GAIM_DEBUG_WARNING, category, format, args);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
132 va_end(args);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
133 }
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
134
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
135 void
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
136 gaim_debug_error(const char *category, const char *format, ...)
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
137 {
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
138 va_list args;
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
139
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
140 g_return_if_fail(format != NULL);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
141
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
142 va_start(args, format);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
143 gaim_debug_vargs(GAIM_DEBUG_ERROR, category, format, args);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
144 va_end(args);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
145 }
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
146
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
147 void
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
148 gaim_debug_fatal(const char *category, const char *format, ...)
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
149 {
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
150 va_list args;
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
151
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
152 g_return_if_fail(format != NULL);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
153
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
154 va_start(args, format);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
155 gaim_debug_vargs(GAIM_DEBUG_FATAL, category, format, args);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
156 va_end(args);
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
157 }
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
158
acc4376ce062 [gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents: 6483
diff changeset
159 void
10307
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
160 gaim_debug_set_enabled(gboolean enabled)
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
161 {
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
162 debug_enabled = enabled;
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
163 }
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
164
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
165 gboolean
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
166 gaim_debug_is_enabled()
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
167 {
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
168 return debug_enabled;
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
169 }
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
170
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
171 void
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6721
diff changeset
172 gaim_debug_set_ui_ops(GaimDebugUiOps *ops)
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
173 {
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
174 debug_ui_ops = ops;
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
175 }
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
176
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
177 GaimDebugUiOps *
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6721
diff changeset
178 gaim_debug_get_ui_ops(void)
5212
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
179 {
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
180 return debug_ui_ops;
740303e8425b [gaim-migrate @ 5582]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181 }
10307
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
182
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
183 void
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
184 gaim_debug_init(void)
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
185 {
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
186 gaim_prefs_add_none("/core/debug");
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
187
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
188 /*
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
189 * This pref is currently used by both the console
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
190 * output and the debug window output.
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
191 */
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
192 gaim_prefs_add_bool("/core/debug/timestamps", FALSE);
2ac21bf20e04 [gaim-migrate @ 11497]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
193 }