3
* oFono - Open Source Telephony
5
* Copyright (C) 2008-2009 Intel Corporation. All rights reserved.
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License version 2 as
9
* published by the Free Software Foundation.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31
static volatile gboolean debug_enabled = FALSE;
35
* @format: format string
36
* @Varargs: list of arguments
38
* Output general information
40
void ofono_info(const char *format, ...)
46
vsyslog(LOG_INFO, format, ap);
53
* @format: format string
54
* @Varargs: list of arguments
56
* Output warning messages
58
void ofono_warn(const char *format, ...)
64
vsyslog(LOG_WARNING, format, ap);
71
* @format: format string
72
* @varargs: list of arguments
74
* Output error messages
76
void ofono_error(const char *format, ...)
82
vsyslog(LOG_ERR, format, ap);
89
* @format: format string
90
* @varargs: list of arguments
92
* Output debug message
94
* The actual output of the debug message is controlled via a command line
95
* switch. If not enabled, these messages will be ignored.
97
void ofono_debug(const char *format, ...)
101
if (debug_enabled == FALSE)
104
va_start(ap, format);
106
vsyslog(LOG_DEBUG, format, ap);
111
void __ofono_toggle_debug(void)
113
if (debug_enabled == TRUE)
114
debug_enabled = FALSE;
116
debug_enabled = TRUE;
119
int __ofono_log_init(gboolean detach, gboolean debug)
121
int option = LOG_NDELAY | LOG_PID;
124
option |= LOG_PERROR;
126
openlog("ofonod", option, LOG_DAEMON);
128
syslog(LOG_INFO, "oFono version %s", VERSION);
130
debug_enabled = debug;
135
void __ofono_log_cleanup(void)
137
syslog(LOG_INFO, "Exit");