Mon, 18 Oct 2021 01:36:58 -0500
Add gi-docgen as a subproject so we can convert the documentation to it
Testing Done:
Just compiled and verified that our `.wrap` file didn't get overwritten by a `wrap-file` from gplugin.
Reviewed at https://reviews.imfreedom.org/r/1055/
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
1 | /* |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
| 5212 | 4 | * |
| 15884 | 5 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 7 | * source distribution. | |
|
6483
d12ecdf8e489
[gaim-migrate @ 6997]
Christian Hammond <chipx86@chipx86.com>
parents:
5212
diff
changeset
|
8 | * |
| 5212 | 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by | |
| 11 | * the Free Software Foundation; either version 2 of the License, or | |
| 12 | * (at your option) any later version. | |
| 13 | * | |
| 14 | * This program is distributed in the hope that it will be useful, | |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | * GNU General Public License for more details. | |
| 18 | * | |
| 19 | * You should have received a copy of the GNU General Public License | |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
| 5212 | 21 | */ |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
22 | |
| 5212 | 23 | #include "debug.h" |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
24 | #include "prefs.h" |
| 5212 | 25 | |
|
38643
cb7fbf08fcb7
Convert PurpleDebugUiOps into an interface.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35597
diff
changeset
|
26 | static PurpleDebugUi *debug_ui = NULL; |
| 5212 | 27 | |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
28 | /* |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
29 | * This determines whether debug info should be written to the |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
30 | * console or not. |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
31 | * |
| 15884 | 32 | * It doesn't make sense to make this a normal Purple preference |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
33 | * because it's a command line option. This will always be FALSE, |
|
27542
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
34 | * unless the user explicitly started the UI with the -d flag. |
| 15884 | 35 | * It doesn't matter what this value was the last time Purple was |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
36 | * started, so it doesn't make sense to save it in prefs. |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
37 | */ |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
38 | static gboolean debug_enabled = FALSE; |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
39 | |
|
27542
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
40 | /* |
|
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
41 | * These determine whether verbose or unsafe debugging are desired. I |
|
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
42 | * don't want to make these purple preferences because their values should |
|
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
43 | * not be remembered across instances of the UI. |
|
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
44 | */ |
|
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
45 | static gboolean debug_verbose = FALSE; |
|
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
46 | static gboolean debug_unsafe = FALSE; |
|
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
47 | |
|
34296
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
48 | static gboolean debug_colored = FALSE; |
|
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
49 | |
|
11504
eabc708c2ea9
[gaim-migrate @ 13749]
Richard Laager <rlaager@pidgin.im>
parents:
11256
diff
changeset
|
50 | static void |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
51 | purple_debug_vargs(PurpleDebugLevel level, const gchar *category, |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
52 | const gchar *format, va_list args) |
| 5212 | 53 | { |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
54 | PurpleDebugUi *ui; |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
55 | gchar *arg_s = NULL; |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
56 | |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
57 | if(!debug_enabled) { |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
58 | return; |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
59 | } |
| 5212 | 60 | |
| 15884 | 61 | g_return_if_fail(level != PURPLE_DEBUG_ALL); |
| 5212 | 62 | g_return_if_fail(format != NULL); |
| 63 | ||
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
64 | ui = purple_debug_get_ui(); |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
65 | if(!ui) { |
|
38643
cb7fbf08fcb7
Convert PurpleDebugUiOps into an interface.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35597
diff
changeset
|
66 | return; |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
67 | } |
|
13988
a178d3dcbb7f
[gaim-migrate @ 16445]
Mark Doliner <markdoliner@pidgin.im>
parents:
13105
diff
changeset
|
68 | |
|
a178d3dcbb7f
[gaim-migrate @ 16445]
Mark Doliner <markdoliner@pidgin.im>
parents:
13105
diff
changeset
|
69 | arg_s = g_strdup_vprintf(format, args); |
|
34296
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
70 | g_strchomp(arg_s); /* strip trailing linefeeds */ |
|
13988
a178d3dcbb7f
[gaim-migrate @ 16445]
Mark Doliner <markdoliner@pidgin.im>
parents:
13105
diff
changeset
|
71 | |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
72 | if(debug_enabled) { |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
73 | GDateTime *now = NULL; |
|
13988
a178d3dcbb7f
[gaim-migrate @ 16445]
Mark Doliner <markdoliner@pidgin.im>
parents:
13105
diff
changeset
|
74 | gchar *ts_s; |
|
34296
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
75 | const gchar *format_pre, *format_post; |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
76 | |
|
34296
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
77 | format_pre = ""; |
|
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
78 | format_post = ""; |
|
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
79 | |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
80 | if(!debug_colored) { |
|
34296
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
81 | format_pre = ""; |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
82 | } else if(level == PURPLE_DEBUG_MISC) { |
|
34296
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
83 | format_pre = "\033[0;37m"; |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
84 | } else if(level == PURPLE_DEBUG_INFO) { |
|
34296
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
85 | format_pre = ""; |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
86 | } else if(level == PURPLE_DEBUG_WARNING) { |
|
34296
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
87 | format_pre = "\033[0;33m"; |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
88 | } else if(level == PURPLE_DEBUG_ERROR) { |
|
34296
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
89 | format_pre = "\033[1;31m"; |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
90 | } else if(level == PURPLE_DEBUG_FATAL) { |
|
34296
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
91 | format_pre = "\033[1;33;41m"; |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
92 | } |
|
34296
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
93 | |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
94 | if(format_pre[0] != '\0') { |
|
34296
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
95 | format_post = "\033[0m"; |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
96 | } |
|
17040
cb33027a36e4
Force timestamps always on for debug log and debug window. Making this
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16478
diff
changeset
|
97 | |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
98 | now = g_date_time_new_now_local(); |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
99 | ts_s = g_date_time_format(now, "(%H:%M:%S)"); |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
100 | g_date_time_unref(now); |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
101 | |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
102 | if(category == NULL) { |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
103 | g_print("%s%s %s%s\n", format_pre, ts_s, arg_s, format_post); |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
104 | } else { |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
105 | g_print("%s%s %s: %s%s\n", format_pre, ts_s, category, arg_s, |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
106 | format_post); |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
107 | } |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
108 | |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
109 | g_free(ts_s); |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
110 | } |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
111 | |
|
41082
d19ef491d1aa
Fix console logging and turn it on unconditionally if we're doing a debug build
Gary Kramlich <grim@reaperworld.com>
parents:
40950
diff
changeset
|
112 | if(purple_debug_ui_is_enabled(ui, level, category)) { |
|
d19ef491d1aa
Fix console logging and turn it on unconditionally if we're doing a debug build
Gary Kramlich <grim@reaperworld.com>
parents:
40950
diff
changeset
|
113 | purple_debug_ui_print(ui, level, category, arg_s); |
|
d19ef491d1aa
Fix console logging and turn it on unconditionally if we're doing a debug build
Gary Kramlich <grim@reaperworld.com>
parents:
40950
diff
changeset
|
114 | } |
| 5212 | 115 | |
|
13988
a178d3dcbb7f
[gaim-migrate @ 16445]
Mark Doliner <markdoliner@pidgin.im>
parents:
13105
diff
changeset
|
116 | g_free(arg_s); |
| 5212 | 117 | } |
| 118 | ||
| 119 | void | |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
120 | purple_debug(PurpleDebugLevel level, const gchar *category, |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
121 | const gchar *format, ...) |
| 5212 | 122 | { |
| 123 | va_list args; | |
| 124 | ||
| 15884 | 125 | g_return_if_fail(level != PURPLE_DEBUG_ALL); |
| 5212 | 126 | g_return_if_fail(format != NULL); |
| 127 | ||
| 128 | va_start(args, format); | |
| 15884 | 129 | purple_debug_vargs(level, category, format, args); |
| 5212 | 130 | va_end(args); |
| 131 | } | |
| 132 | ||
| 133 | void | |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
134 | purple_debug_misc(const gchar *category, const gchar *format, ...) { |
|
6721
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
135 | va_list args; |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
136 | |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
137 | g_return_if_fail(format != NULL); |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
138 | |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
139 | va_start(args, format); |
| 15884 | 140 | purple_debug_vargs(PURPLE_DEBUG_MISC, category, format, args); |
|
6721
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
141 | va_end(args); |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
142 | } |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
143 | |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
144 | void |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
145 | purple_debug_info(const gchar *category, const gchar *format, ...) { |
|
6721
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
146 | va_list args; |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
147 | |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
148 | g_return_if_fail(format != NULL); |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
149 | |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
150 | va_start(args, format); |
| 15884 | 151 | purple_debug_vargs(PURPLE_DEBUG_INFO, category, format, args); |
|
6721
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
152 | va_end(args); |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
153 | } |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
154 | |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
155 | void |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
156 | purple_debug_warning(const gchar *category, const gchar *format, ...) { |
|
6721
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
157 | va_list args; |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
158 | |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
159 | g_return_if_fail(format != NULL); |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
160 | |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
161 | va_start(args, format); |
| 15884 | 162 | purple_debug_vargs(PURPLE_DEBUG_WARNING, category, format, args); |
|
6721
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
163 | va_end(args); |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
164 | } |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
165 | |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
166 | void |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
167 | purple_debug_error(const gchar *category, const gchar *format, ...) { |
|
6721
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
168 | va_list args; |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
169 | |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
170 | g_return_if_fail(format != NULL); |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
171 | |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
172 | va_start(args, format); |
| 15884 | 173 | purple_debug_vargs(PURPLE_DEBUG_ERROR, category, format, args); |
|
6721
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
174 | va_end(args); |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
175 | } |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
176 | |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
177 | void |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
178 | purple_debug_fatal(const gchar *category, const gchar *format, ...) { |
|
6721
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
179 | va_list args; |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
180 | |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
181 | g_return_if_fail(format != NULL); |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
182 | |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
183 | va_start(args, format); |
| 15884 | 184 | purple_debug_vargs(PURPLE_DEBUG_FATAL, category, format, args); |
|
6721
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
185 | va_end(args); |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
186 | } |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
187 | |
|
41d2d86860f3
[gaim-migrate @ 7248]
Christian Hammond <chipx86@chipx86.com>
parents:
6483
diff
changeset
|
188 | void |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
189 | purple_debug_set_enabled(gboolean enabled) { |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
190 | debug_enabled = enabled; |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
191 | } |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
192 | |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
193 | gboolean |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
194 | purple_debug_is_enabled() { |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
195 | return debug_enabled; |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
196 | } |
|
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
197 | |
|
38643
cb7fbf08fcb7
Convert PurpleDebugUiOps into an interface.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35597
diff
changeset
|
198 | void |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
199 | purple_debug_set_ui(PurpleDebugUi *ui) { |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
200 | g_set_object(&debug_ui, ui); |
| 5212 | 201 | } |
| 202 | ||
|
27542
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
203 | gboolean |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
204 | purple_debug_is_verbose() { |
|
27542
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
205 | return debug_verbose; |
|
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
206 | } |
|
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
207 | |
|
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
208 | void |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
209 | purple_debug_set_verbose(gboolean verbose) { |
|
27542
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
210 | debug_verbose = verbose; |
|
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
211 | } |
|
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
212 | |
|
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
213 | gboolean |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
214 | purple_debug_is_unsafe() { |
|
27542
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
215 | return debug_unsafe; |
|
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
216 | } |
|
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
217 | |
|
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
218 | void |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
219 | purple_debug_set_unsafe(gboolean unsafe) { |
|
27542
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
220 | debug_unsafe = unsafe; |
|
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
221 | } |
|
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
222 | |
|
34296
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
223 | void |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
224 | purple_debug_set_colored(gboolean colored) { |
|
34296
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
225 | debug_colored = colored; |
|
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
226 | } |
|
d31a4f3b547e
Debug log: optional colored output and no need for add linefeed at the end of each message
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32438
diff
changeset
|
227 | |
|
38643
cb7fbf08fcb7
Convert PurpleDebugUiOps into an interface.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35597
diff
changeset
|
228 | PurpleDebugUi * |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
229 | purple_debug_get_ui(void) { |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
230 | return debug_ui; |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
231 | } |
|
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
232 | |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
233 | void |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
234 | purple_debug_init(void) { |
|
27542
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
235 | /* Read environment variables once per init */ |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
236 | if(g_getenv("PURPLE_UNSAFE_DEBUG")) { |
|
27542
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
237 | purple_debug_set_unsafe(TRUE); |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
238 | } |
|
27542
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
239 | |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
240 | if(g_getenv("PURPLE_VERBOSE_DEBUG")) { |
|
27542
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
241 | purple_debug_set_verbose(TRUE); |
|
40828
4ee19005534e
Modernize debug.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39913
diff
changeset
|
242 | } |
|
27542
a7acdc4ba23f
Move the handling of PURPLE_UNSAFE_DEBUG to purple_debug_init(). Also add
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20147
diff
changeset
|
243 | |
|
17318
ce44d0f8095d
Un-break the API so the next release doesn't have to be 3.0.0 :)
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17040
diff
changeset
|
244 | purple_prefs_add_none("/purple/debug"); |
|
10307
f3ba80364053
[gaim-migrate @ 11497]
Mark Doliner <markdoliner@pidgin.im>
parents:
8046
diff
changeset
|
245 | } |