diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2015-11-11 15:09:02 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-11-11 15:09:02 +0100 |
commit | b329e8edd469f1b40b1232ccbd3df9c2bc30087a (patch) | |
tree | 09d02d8e13408ae1eb1ca169a6be4808d6480a2e /src | |
parent | 29a4871ab80a67a1a7245d969fecf5e08d8ee7e0 (diff) | |
download | bluez-b329e8edd469f1b40b1232ccbd3df9c2bc30087a.tar.gz |
core: Use daemon specific GLib logging handling for backtraces
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c index 2001ceed8..ebc93f598 100644 --- a/src/main.c +++ b/src/main.c @@ -361,6 +361,21 @@ static void init_defaults(void) main_opts.did_version = (major << 8 | minor); } +static void log_handler(const gchar *log_domain, GLogLevelFlags log_level, + const gchar *message, gpointer user_data) +{ + int priority; + + if (log_level & (G_LOG_LEVEL_ERROR | + G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING)) + priority = 0x03; + else + priority = 0x06; + + btd_log(0xffff, priority, "GLib: %s", message); + btd_backtrace(0xffff); +} + static GMainLoop *event_loop; void btd_exit(void) @@ -594,6 +609,10 @@ int main(int argc, char *argv[]) __btd_log_init(option_debug, option_detach); + g_log_set_handler("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | + G_LOG_FLAG_RECURSION, + log_handler, NULL); + sd_notify(0, "STATUS=Starting up"); main_conf = load_config(CONFIGDIR "/main.conf"); |