[Galago-commits] r2349 - in trunk/gaim-galago: . src
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Sun Nov 27 21:15:44 PST 2005
Author: chipx86
Date: 2005-11-27 21:15:42 -0800 (Sun, 27 Nov 2005)
New Revision: 2349
Modified:
trunk/gaim-galago/ChangeLog
trunk/gaim-galago/src/gaim-galago.c
Log:
Register a "Galago" glib log handler instead of an old-style galago_log_* handler.
Modified: trunk/gaim-galago/ChangeLog
===================================================================
--- trunk/gaim-galago/ChangeLog 2005-11-28 05:06:40 UTC (rev 2348)
+++ trunk/gaim-galago/ChangeLog 2005-11-28 05:15:42 UTC (rev 2349)
@@ -1,3 +1,9 @@
+Sun Nov 27 21:13:27 PST 2005 Christian Hammond <chipx86 at chipx86.com>
+
+ * src/gaim-galago.c:
+ - Register a "Galago" glib log handler instead of an old-style
+ galago_log_* handler.
+
Thu Nov 24 17:24:57 PST 2005 Christian Hammond <chipx86 at chipx86.com>
* src/gaim-galago.c:
Modified: trunk/gaim-galago/src/gaim-galago.c
===================================================================
--- trunk/gaim-galago/src/gaim-galago.c 2005-11-28 05:06:40 UTC (rev 2348)
+++ trunk/gaim-galago/src/gaim-galago.c 2005-11-28 05:15:42 UTC (rev 2349)
@@ -29,6 +29,7 @@
#include "debug.h"
#include "plugin.h"
#include "server.h"
+#include "util.h"
#include "version.h"
#if GAIM_VERSION_CHECK(2,0,0)
@@ -491,22 +492,62 @@
}
}
+/*
+ * More or less copy-and-pasted from gtkdebug.c in gaim.
+ */
static void
-log_handler(GalagoLogLevel level, const char *msg, va_list args,
- void *user_data)
+log_handler(const gchar *domain, GLogLevelFlags flags,
+ const gchar *msg, gpointer user_data)
{
- GaimDebugLevel debug_level = (GaimDebugLevel)level;
+ GaimDebugLevel level;
+ char *new_msg = NULL;
+ char *new_domain = NULL;
- if (level == GALAGO_LOG_ASSERT)
- debug_level = GAIM_DEBUG_WARNING;
+ if ((flags & G_LOG_LEVEL_ERROR) == G_LOG_LEVEL_ERROR)
+ level = GAIM_DEBUG_ERROR;
+ else if ((flags & G_LOG_LEVEL_CRITICAL) == G_LOG_LEVEL_CRITICAL)
+ level = GAIM_DEBUG_FATAL;
+ else if ((flags & G_LOG_LEVEL_WARNING) == G_LOG_LEVEL_WARNING)
+ level = GAIM_DEBUG_WARNING;
+ else if ((flags & G_LOG_LEVEL_MESSAGE) == G_LOG_LEVEL_MESSAGE)
+ level = GAIM_DEBUG_INFO;
+ else if ((flags & G_LOG_LEVEL_INFO) == G_LOG_LEVEL_INFO)
+ level = GAIM_DEBUG_INFO;
+ else if ((flags & G_LOG_LEVEL_DEBUG) == G_LOG_LEVEL_DEBUG)
+ level = GAIM_DEBUG_MISC;
+ else
+ {
+ gaim_debug_warning("Galago",
+ "Unknown glib logging level in %d\n", flags);
- gaim_debug_vargs(debug_level, "libgalago", msg, args);
+ level = GAIM_DEBUG_MISC; /* This will never happen. */
+ }
+
+ if (msg != NULL)
+ new_msg = gaim_utf8_try_convert(msg);
+
+ if (domain != NULL)
+ new_domain = gaim_utf8_try_convert(domain);
+
+ if (new_msg != NULL)
+ {
+ gaim_debug(level, (new_domain != NULL ? new_domain : "g_log"),
+ "%s\n", new_msg);
+
+ g_free(new_msg);
+ }
+
+ if (new_domain != NULL)
+ g_free(new_domain);
}
static gboolean
plugin_load(GaimPlugin *plugin)
{
- galago_log_set_handler(GALAGO_LOG_ALL, log_handler, NULL);
+ g_log_set_handler("Galago",
+ G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL |
+ G_LOG_FLAG_RECURSION,
+ log_handler, NULL);
if (!galago_init("gaim", TRUE))
return FALSE;
More information about the galago-commits
mailing list