summaryrefslogtreecommitdiff
path: root/src/log.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2011-08-15 16:07:28 -0700
committerMarcel Holtmann <marcel@holtmann.org>2011-08-15 16:07:28 -0700
commit095049e6721148cb3dbd405c12316f13edc2dd4e (patch)
treea03dd1a2a3bb36c4332506efe60d8aa2b9cde70b /src/log.c
parenta94bafe59b43255a7309bf54ca4536845004a9d9 (diff)
downloadconnman-095049e6721148cb3dbd405c12316f13edc2dd4e.tar.gz
connman-095049e6721148cb3dbd405c12316f13edc2dd4e.tar.bz2
connman-095049e6721148cb3dbd405c12316f13edc2dd4e.zip
log: Use separate function for enable logging
Diffstat (limited to 'src/log.c')
-rw-r--r--src/log.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/log.c b/src/log.c
index eb480b40..2301cdc9 100644
--- a/src/log.c
+++ b/src/log.c
@@ -195,16 +195,16 @@ static connman_bool_t is_enabled(struct connman_debug_desc *desc)
return FALSE;
}
-int __connman_log_init(const char *debug, connman_bool_t detach)
+void __connman_log_enable(struct connman_debug_desc *start,
+ struct connman_debug_desc *stop)
{
- int option = LOG_NDELAY | LOG_PID;
struct connman_debug_desc *desc;
const char *name = NULL, *file = NULL;
- if (debug != NULL)
- enabled = g_strsplit_set(debug, ":, ", 0);
+ if (start == NULL || stop == NULL)
+ return;
- for (desc = __start___debug; desc < __stop___debug; desc++) {
+ for (desc = start; desc < stop; desc++) {
if (desc->flags & CONNMAN_DEBUG_FLAG_ALIAS) {
file = desc->file;
name = desc->name;
@@ -222,6 +222,16 @@ int __connman_log_init(const char *debug, connman_bool_t detach)
if (is_enabled(desc) == TRUE)
desc->flags |= CONNMAN_DEBUG_FLAG_PRINT;
}
+}
+
+int __connman_log_init(const char *debug, connman_bool_t detach)
+{
+ int option = LOG_NDELAY | LOG_PID;
+
+ if (debug != NULL)
+ enabled = g_strsplit_set(debug, ":, ", 0);
+
+ __connman_log_enable(__start___debug, __stop___debug);
if (detach == FALSE)
option |= LOG_PERROR;