From 1d8ff99f756c96f4582e7246b0e8950875186ae9 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 15 Aug 2011 16:12:26 -0700 Subject: log: Use separate function for enable logging --- src/log.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/log.c') diff --git a/src/log.c b/src/log.c index 51d1b0d0..c31a76cc 100644 --- a/src/log.c +++ b/src/log.c @@ -174,16 +174,16 @@ static ofono_bool_t is_enabled(struct ofono_debug_desc *desc) return FALSE; } -int __ofono_log_init(const char *debug, ofono_bool_t detach) +void __ofono_log_enable(struct ofono_debug_desc *start, + struct ofono_debug_desc *stop) { - int option = LOG_NDELAY | LOG_PID; struct ofono_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 (file != NULL || name != NULL) { if (g_strcmp0(desc->file, file) == 0) { if (desc->name == NULL) @@ -195,6 +195,16 @@ int __ofono_log_init(const char *debug, ofono_bool_t detach) if (is_enabled(desc) == TRUE) desc->flags |= OFONO_DEBUG_FLAG_PRINT; } +} + +int __ofono_log_init(const char *debug, ofono_bool_t detach) +{ + int option = LOG_NDELAY | LOG_PID; + + if (debug != NULL) + enabled = g_strsplit_set(debug, ":, ", 0); + + __ofono_log_enable(__start___debug, __stop___debug); if (detach == FALSE) option |= LOG_PERROR; -- cgit v1.2.3