Update log and plugin functions

This commit is contained in:
Marcel Holtmann 2009-05-05 18:56:46 -07:00
parent ed6c14243d
commit 488463da5a
4 changed files with 22 additions and 8 deletions

View File

@ -32,9 +32,12 @@ extern "C" {
* @short_description: Functions for logging error and debug information * @short_description: Functions for logging error and debug information
*/ */
extern void ofono_info(const char *format, ...); extern void ofono_info(const char *format, ...)
extern void ofono_error(const char *format, ...); __attribute__((format(printf, 1, 2)));
extern void ofono_debug(const char *format, ...); extern void ofono_error(const char *format, ...)
__attribute__((format(printf, 1, 2)));
extern void ofono_debug(const char *format, ...)
__attribute__((format(printf, 1, 2)));
/** /**
* DBG: * DBG:

View File

@ -1,6 +1,6 @@
/* /*
* *
* oFono - Open Telephony stack for Linux * oFono - Open Source Telephony
* *
* Copyright (C) 2008-2009 Intel Corporation. All rights reserved. * Copyright (C) 2008-2009 Intel Corporation. All rights reserved.
* *

View File

@ -1,6 +1,6 @@
/* /*
* *
* oFono - Open Telephony stack for Linux * oFono - Open Source Telephony
* *
* Copyright (C) 2008-2009 Intel Corporation. All rights reserved. * Copyright (C) 2008-2009 Intel Corporation. All rights reserved.
* *
@ -90,15 +90,26 @@ void ofono_debug(const char *format, ...)
va_end(ap); va_end(ap);
} }
int __ofono_log_init(void) void __ofono_toggle_debug(void)
{
if (debug_enabled == TRUE)
debug_enabled = FALSE;
else
debug_enabled = TRUE;
}
int __ofono_log_init(gboolean detach, gboolean debug)
{ {
int option = LOG_NDELAY | LOG_PID; int option = LOG_NDELAY | LOG_PID;
if (detach == FALSE)
option |= LOG_PERROR;
openlog("ofonod", option, LOG_DAEMON); openlog("ofonod", option, LOG_DAEMON);
syslog(LOG_INFO, "oFono version %s", VERSION); syslog(LOG_INFO, "oFono version %s", VERSION);
debug_enabled = TRUE; debug_enabled = debug;
return 0; return 0;
} }

View File

@ -1,6 +1,6 @@
/* /*
* *
* oFono - Open Telephony stack for Linux * oFono - Open Source Telephony
* *
* Copyright (C) 2008-2009 Intel Corporation. All rights reserved. * Copyright (C) 2008-2009 Intel Corporation. All rights reserved.
* *