log: Use separate function for enable logging

This commit is contained in:
Marcel Holtmann 2011-08-15 16:12:26 -07:00
parent 041f8dbb06
commit 1d8ff99f75
2 changed files with 17 additions and 5 deletions

View File

@ -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;

View File

@ -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 <ofono/dbus.h>