mirror of git://git.sysmocom.de/ofono
log: Use separate function for enable logging
This commit is contained in:
parent
041f8dbb06
commit
1d8ff99f75
20
src/log.c
20
src/log.c
|
@ -174,16 +174,16 @@ static ofono_bool_t is_enabled(struct ofono_debug_desc *desc)
|
||||||
return FALSE;
|
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;
|
struct ofono_debug_desc *desc;
|
||||||
const char *name = NULL, *file = NULL;
|
const char *name = NULL, *file = NULL;
|
||||||
|
|
||||||
if (debug != NULL)
|
if (start == NULL || stop == NULL)
|
||||||
enabled = g_strsplit_set(debug, ":, ", 0);
|
return;
|
||||||
|
|
||||||
for (desc = __start___debug; desc < __stop___debug; desc++) {
|
for (desc = start; desc < stop; desc++) {
|
||||||
if (file != NULL || name != NULL) {
|
if (file != NULL || name != NULL) {
|
||||||
if (g_strcmp0(desc->file, file) == 0) {
|
if (g_strcmp0(desc->file, file) == 0) {
|
||||||
if (desc->name == NULL)
|
if (desc->name == NULL)
|
||||||
|
@ -195,6 +195,16 @@ int __ofono_log_init(const char *debug, ofono_bool_t detach)
|
||||||
if (is_enabled(desc) == TRUE)
|
if (is_enabled(desc) == TRUE)
|
||||||
desc->flags |= OFONO_DEBUG_FLAG_PRINT;
|
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)
|
if (detach == FALSE)
|
||||||
option |= LOG_PERROR;
|
option |= LOG_PERROR;
|
||||||
|
|
|
@ -36,6 +36,8 @@ void __ofono_modem_shutdown(void);
|
||||||
|
|
||||||
int __ofono_log_init(const char *debug, ofono_bool_t detach);
|
int __ofono_log_init(const char *debug, ofono_bool_t detach);
|
||||||
void __ofono_log_cleanup(void);
|
void __ofono_log_cleanup(void);
|
||||||
|
void __ofono_log_enable(struct ofono_debug_desc *start,
|
||||||
|
struct ofono_debug_desc *stop);
|
||||||
|
|
||||||
#include <ofono/dbus.h>
|
#include <ofono/dbus.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue