From bbc4c1eee1f8bd1bcb55189d6ad692ff6c28f72a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 22 Sep 2015 16:08:44 +0100 Subject: [PATCH] Print assertions from glib to rspamd logger. --- src/libutil/logger.c | 7 +++++++ src/libutil/logger.h | 5 +++++ src/main.c | 1 + 3 files changed, 13 insertions(+) diff --git a/src/libutil/logger.c b/src/libutil/logger.c index d8e78ae63a..57410ad96f 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 c3eb6d2cfa..e8c71465bb 100644 --- a/src/libutil/logger.h +++ b/src/libutil/logger.h @@ -67,6 +67,11 @@ void rspamd_log_flush (rspamd_logger_t *logger); 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 */ diff --git a/src/main.c b/src/main.c index e13925d337..87de76bee7 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); -- 2.47.3