Update log and plugin functions
authorMarcel Holtmann <marcel.holtmann@intel.com>
Wed, 6 May 2009 01:56:46 +0000 (18:56 -0700)
committerMarcel Holtmann <marcel.holtmann@intel.com>
Wed, 6 May 2009 01:56:46 +0000 (18:56 -0700)
include/log.h
include/plugin.h
src/log.c
src/plugin.c

index cdd3b0f..47e5ec8 100644 (file)
@@ -32,9 +32,12 @@ extern "C" {
  * @short_description: Functions for logging error and debug information
  */
 
-extern void ofono_info(const char *format, ...);
-extern void ofono_error(const char *format, ...);
-extern void ofono_debug(const char *format, ...);
+extern void ofono_info(const char *format, ...)
+                               __attribute__((format(printf, 1, 2)));
+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:
index 4b01ad4..7c133e3 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *  oFono - Open Telephony stack for Linux
+ *  oFono - Open Source Telephony
  *
  *  Copyright (C) 2008-2009  Intel Corporation. All rights reserved.
  *
index d79c99f..273e3ba 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -1,6 +1,6 @@
 /*
  *
- *  oFono - Open Telephony stack for Linux
+ *  oFono - Open Source Telephony
  *
  *  Copyright (C) 2008-2009  Intel Corporation. All rights reserved.
  *
@@ -90,15 +90,26 @@ void ofono_debug(const char *format, ...)
        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;
 
+       if (detach == FALSE)
+               option |= LOG_PERROR;
+
        openlog("ofonod", option, LOG_DAEMON);
 
        syslog(LOG_INFO, "oFono version %s", VERSION);
 
-       debug_enabled = TRUE;
+       debug_enabled = debug;
 
        return 0;
 }
index 9fdb332..9822359 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- *  oFono - Open Telephony stack for Linux
+ *  oFono - Open Source Telephony
  *
  *  Copyright (C) 2008-2009  Intel Corporation. All rights reserved.
  *