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; diff --git a/src/ofono.h b/src/ofono.h index 5e3a6b59..188c6643 100644 --- a/src/ofono.h +++ b/src/ofono.h @@ -36,6 +36,8 @@ void __ofono_modem_shutdown(void); int __ofono_log_init(const char *debug, ofono_bool_t detach); void __ofono_log_cleanup(void); +void __ofono_log_enable(struct ofono_debug_desc *start, + struct ofono_debug_desc *stop); #include