Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 2/3] Fix logging for obex-client
Date: Tue,  7 Dec 2010 17:01:00 +0200	[thread overview]
Message-ID: <1291734061-24408-2-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1291734061-24408-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>

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.
---
 client/main.c |    2 +-
 src/log.c     |    6 +++---
 src/log.h     |    2 +-
 src/main.c    |    2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/client/main.c b/client/main.c
index 74db15e..20d56d2 100644
--- a/client/main.c
+++ b/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/src/log.c b/src/log.c
index 39489a2..baa57c5 100644
--- a/src/log.c
+++ b/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/src/log.h b/src/log.h
index 1bf1b05..e322565 100644
--- a/src/log.h
+++ b/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/src/main.c b/src/main.c
index 14e7d16..1e78615 100644
--- a/src/main.c
+++ b/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");
 
-- 
1.7.1


  reply	other threads:[~2010-12-07 15:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-07 15:00 [PATCH 1/3] Fix possible crash when processing session callback Luiz Augusto von Dentz
2010-12-07 15:01 ` Luiz Augusto von Dentz [this message]
2010-12-07 15:01 ` [PATCH 3/3] Add support for stat files bigger than 2GB on 32-bit systems Luiz Augusto von Dentz
2010-12-07 21:17 ` [PATCH 1/3] Fix possible crash when processing session callback Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1291734061-24408-2-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox