diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2011-08-15 16:12:26 -0700 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2011-08-15 16:12:26 -0700 |
commit | 1d8ff99f756c96f4582e7246b0e8950875186ae9 (patch) | |
tree | 61f9c296b12e4eb352efe1910fe0ffb8b585d5f2 /src/log.c | |
parent | 041f8dbb06f7158a0e050d7d4e328adcbb3eb441 (diff) | |
download | ofono-1d8ff99f756c96f4582e7246b0e8950875186ae9.tar.bz2 |
log: Use separate function for enable logging
Diffstat (limited to 'src/log.c')
-rw-r--r-- | src/log.c | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -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; |