summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-09-22 16:08:44 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-09-22 16:08:44 +0100
commitbbc4c1eee1f8bd1bcb55189d6ad692ff6c28f72a (patch)
treec75c7ea3751def4d0770ce76060e0b4c5d30d3a5
parent74bf7ad25800bb510735a245f88728e1e1aad725 (diff)
downloadrspamd-bbc4c1eee1f8bd1bcb55189d6ad692ff6c28f72a.tar.gz
rspamd-bbc4c1eee1f8bd1bcb55189d6ad692ff6c28f72a.zip
Print assertions from glib to rspamd logger.
-rw-r--r--src/libutil/logger.c7
-rw-r--r--src/libutil/logger.h5
-rw-r--r--src/main.c1
3 files changed, 13 insertions, 0 deletions
diff --git a/src/libutil/logger.c b/src/libutil/logger.c
index d8e78ae63..57410ad96 100644
--- a/src/libutil/logger.c
+++ b/src/libutil/logger.c
@@ -920,6 +920,13 @@ rspamd_glib_log_function (const gchar *log_domain,
}
}
+void
+rspamd_glib_printerr_function (const gchar *message)
+{
+ rspamd_common_logv (NULL, G_LOG_LEVEL_CRITICAL, "glib", NULL, G_STRFUNC,
+ message, NULL);
+}
+
/**
* Temporary turn on debugging
*/
diff --git a/src/libutil/logger.h b/src/libutil/logger.h
index c3eb6d2cf..e8c71465b 100644
--- a/src/libutil/logger.h
+++ b/src/libutil/logger.h
@@ -68,6 +68,11 @@ void rspamd_glib_log_function (const gchar *log_domain,
GLogLevelFlags log_level, const gchar *message, gpointer arg);
/**
+ * Log function for printing glib assertions
+ */
+void rspamd_glib_printerr_function (const gchar *message);
+
+/**
* Function with variable number of arguments support
*/
void rspamd_common_log_function (rspamd_logger_t *logger,
diff --git a/src/main.c b/src/main.c
index e13925d33..87de76bee 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1143,6 +1143,7 @@ main (gint argc, gchar **argv, gchar **env)
rspamd_set_logger (rspamd_main->cfg, type, rspamd_main);
(void)rspamd_log_open (rspamd_main->logger);
g_log_set_default_handler (rspamd_glib_log_function, rspamd_main->logger);
+ g_set_printerr_handler (rspamd_glib_printerr_function);
detect_priv (rspamd_main);