From 127fe7b3cfb91aa2ec22beaee52f31b50d8ff5d6 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 7 Dec 2010 17:01:00 +0200 Subject: [PATCH] obexd: Fix logging for obex-client Since obex-client and obexd share the same log code they both were using obexd for openlog which makes it very confusing when reading the logs. To fix this now __obex_log_init takes the binary name so that each daemon can be properly labeled. --- obexd/client/main.c | 2 +- obexd/src/log.c | 6 +++--- obexd/src/log.h | 2 +- obexd/src/main.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/obexd/client/main.c b/obexd/client/main.c index 74db15e2c..20d56d2a8 100644 --- a/obexd/client/main.c +++ b/obexd/client/main.c @@ -613,7 +613,7 @@ int main(int argc, char *argv[]) event_loop = g_main_loop_new(NULL, FALSE); - __obex_log_init(option_debug, !option_stderr); + __obex_log_init("obex-client", option_debug, !option_stderr); DBG("Entering main loop"); diff --git a/obexd/src/log.c b/obexd/src/log.c index 39489a26f..baa57c5e3 100644 --- a/obexd/src/log.c +++ b/obexd/src/log.c @@ -100,7 +100,7 @@ void __obex_log_enable_debug() desc->flags |= OBEX_DEBUG_FLAG_PRINT; } -void __obex_log_init(const char *debug, int detach) +void __obex_log_init(const char *label, const char *debug, int detach) { int option = LOG_NDELAY | LOG_PID; struct obex_debug_desc *desc; @@ -125,9 +125,9 @@ void __obex_log_init(const char *debug, int detach) if (!detach) option |= LOG_PERROR; - openlog("obexd", option, LOG_DAEMON); + openlog(label, option, LOG_DAEMON); - syslog(LOG_INFO, "OBEX daemon %s", VERSION); + syslog(LOG_INFO, "%s daemon %s", label, VERSION); } void __obex_log_cleanup(void) diff --git a/obexd/src/log.h b/obexd/src/log.h index 1bf1b058b..e32256582 100644 --- a/obexd/src/log.h +++ b/obexd/src/log.h @@ -26,7 +26,7 @@ void error(const char *format, ...) __attribute__((format(printf, 1, 2))); void obex_debug(const char *format, ...) __attribute__((format(printf, 1, 2))); -void __obex_log_init(const char *debug, int detach); +void __obex_log_init(const char *label, const char *debug, int detach); void __obex_log_cleanup(void); void __obex_log_enable_debug(void); diff --git a/obexd/src/main.c b/obexd/src/main.c index 14e7d16e1..1e7861578 100644 --- a/obexd/src/main.c +++ b/obexd/src/main.c @@ -218,7 +218,7 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } - __obex_log_init(option_debug, option_detach); + __obex_log_init("obexd", option_debug, option_detach); DBG("Entering main loop"); -- 2.47.3