--- a/libpurple/debug.c Tue Oct 19 00:30:58 2021 -0500
+++ b/libpurple/debug.c Tue Oct 19 00:40:28 2021 -0500
@@ -51,69 +51,39 @@
purple_debug_vargs(PurpleDebugLevel level, const gchar *category,
const gchar *format, va_list args)
+ GLogLevelFlags log_level = G_LOG_LEVEL_DEBUG;
- g_return_if_fail(level != PURPLE_DEBUG_ALL);
g_return_if_fail(format != NULL);
- ui = purple_debug_get_ui();
+ /* GLib's debug levels are not quite the same as ours, so we need to + case PURPLE_DEBUG_MISC: + log_level = G_LOG_LEVEL_INFO; + case PURPLE_DEBUG_INFO: + log_level = G_LOG_LEVEL_MESSAGE; + case PURPLE_DEBUG_WARNING: + log_level = G_LOG_LEVEL_WARNING; + case PURPLE_DEBUG_ERROR: + log_level = G_LOG_LEVEL_CRITICAL; + case PURPLE_DEBUG_FATAL: + log_level = G_LOG_LEVEL_ERROR; - arg_s = g_strdup_vprintf(format, args);
- g_strchomp(arg_s); /* strip trailing linefeeds */
- const gchar *format_pre, *format_post;
+ /* strip trailing linefeeds */ + msg = g_strdup(format);
- } else if(level == PURPLE_DEBUG_MISC) {
- format_pre = "\033[0;37m";
- } else if(level == PURPLE_DEBUG_INFO) {
- } else if(level == PURPLE_DEBUG_WARNING) {
- format_pre = "\033[0;33m";
- } else if(level == PURPLE_DEBUG_ERROR) {
- format_pre = "\033[1;31m";
- } else if(level == PURPLE_DEBUG_FATAL) {
- format_pre = "\033[1;33;41m";
- if(format_pre[0] != '\0') {
- format_post = "\033[0m";
- now = g_date_time_new_now_local();
- ts_s = g_date_time_format(now, "(%H:%M:%S)");
- g_date_time_unref(now);
- g_print("%s%s %s%s\n", format_pre, ts_s, arg_s, format_post);
- g_print("%s%s %s: %s%s\n", format_pre, ts_s, category, arg_s,
- if(purple_debug_ui_is_enabled(ui, level, category)) {
- purple_debug_ui_print(ui, level, category, arg_s);
+ g_logv(category, log_level, msg, args);