diff --git a/obexd/client/main.c b/obexd/client/main.c
index 3bde09e..29fbab1 100644
--- a/obexd/client/main.c
+++ b/obexd/client/main.c
DBusConnection *conn;
DBusError derr;
GError *gerr = NULL;
- int log_option = 0;
context = g_option_context_new(NULL);
g_option_context_add_main_entries(context, options, NULL);
exit(EXIT_FAILURE);
}
- if (option_stderr == TRUE)
- log_option |= LOG_PERROR;
-
event_loop = g_main_loop_new(NULL, FALSE);
- log_init("obex-client", option_debug, log_option);
+ __obex_log_init(option_debug, option_stderr);
DBG("Entering main loop");
g_main_loop_unref(event_loop);
+ __obex_log_cleanup();
+
return 0;
}
diff --git a/obexd/src/log.c b/obexd/src/log.c
index 8c5d769..39489a2 100644
--- a/obexd/src/log.c
+++ b/obexd/src/log.c
static gchar **enabled = NULL;
-int debug_enabled = FALSE;
-
static gboolean is_enabled(struct obex_debug_desc *desc)
{
int i;
return 0;
}
-void log_enable_debug()
+void __obex_log_enable_debug()
{
struct obex_debug_desc *desc;
desc->flags |= OBEX_DEBUG_FLAG_PRINT;
}
-void log_init(const char *ident, const char *debug, int log_option)
+void __obex_log_init(const char *debug, int detach)
{
- int option = log_option | LOG_NDELAY | LOG_PID;
+ int option = LOG_NDELAY | LOG_PID;
struct obex_debug_desc *desc;
const char *name = NULL, *file = NULL;
desc->flags |= OBEX_DEBUG_FLAG_PRINT;
}
- openlog(ident, option, LOG_DAEMON);
+ if (!detach)
+ option |= LOG_PERROR;
+
+ openlog("obexd", option, LOG_DAEMON);
- syslog(LOG_INFO, "%s version %s", ident, VERSION);
+ syslog(LOG_INFO, "OBEX daemon %s", VERSION);
}
-void log_cleanup(void)
+void __obex_log_cleanup(void)
{
closelog();
diff --git a/obexd/src/log.h b/obexd/src/log.h
index 93d8dde..1bf1b05 100644
--- a/obexd/src/log.h
+++ b/obexd/src/log.h
void info(const char *format, ...) __attribute__((format(printf, 1, 2)));
void error(const char *format, ...) __attribute__((format(printf, 1, 2)));
+
void obex_debug(const char *format, ...) __attribute__((format(printf, 1, 2)));
-void log_init(const char *ident, const char *debug, int log_option);
-void log_cleanup(void);
-void log_enable_debug(void);
+void __obex_log_init(const char *debug, int detach);
+void __obex_log_cleanup(void);
+void __obex_log_enable_debug(void);
struct obex_debug_desc {
const char *name;
diff --git a/obexd/src/main.c b/obexd/src/main.c
index b4c0508..649acf9 100644
--- a/obexd/src/main.c
+++ b/obexd/src/main.c
static void sig_debug(int sig)
{
- log_enable_debug();
+ __obex_log_enable_debug();
}
static gboolean option_detach = TRUE;
GOptionContext *context;
GError *err = NULL;
struct sigaction sa;
- int log_option = 0;
#ifdef NEED_THREADS
if (g_thread_supported() == FALSE)
perror("Can't start daemon");
exit(1);
}
- } else
- log_option |= LOG_PERROR;
+ }
if (option_opp == FALSE && option_ftp == FALSE &&
option_pbap == FALSE &&
exit(EXIT_FAILURE);
}
- log_init("obexd", option_debug, log_option);
+ __obex_log_init(option_debug, option_detach);
DBG("Entering main loop");
g_free(option_capability);
g_free(option_root);
- closelog();
+ __obex_log_cleanup();
return 0;
}