From: Marcel Holtmann Date: Mon, 15 Aug 2011 23:07:28 +0000 (-0700) Subject: log: Use separate function for enable logging X-Git-Tag: 2.0_alpha~1239 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=095049e6721148cb3dbd405c12316f13edc2dd4e;p=framework%2Fconnectivity%2Fconnman.git log: Use separate function for enable logging --- diff --git a/src/connman.h b/src/connman.h index 2fc0e92..6e68c99 100644 --- a/src/connman.h +++ b/src/connman.h @@ -98,6 +98,8 @@ int __connman_agent_report_error(struct connman_service *service, int __connman_log_init(const char *debug, connman_bool_t detach); void __connman_log_cleanup(void); +void __connman_log_enable(struct connman_debug_desc *start, + struct connman_debug_desc *stop); void __connman_debug_list_available(DBusMessageIter *iter, void *user_data); void __connman_debug_list_enabled(DBusMessageIter *iter, void *user_data); diff --git a/src/log.c b/src/log.c index eb480b4..2301cdc 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;