xml: first implementation bits
[siplcs.git] / src / purple / purple-debug.c
blob88cc215ab5e711b589ea2828f61e6c43ee1ce9d0
1 /**
2 * @file purple-debug.c
4 * pidgin-sipe
6 * Copyright (C) 2010 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <stdarg.h>
25 #include "glib.h"
26 #include "glib/gprintf.h"
27 #include "debug.h"
29 #include "sipe-backend-debug.h"
31 void sipe_backend_debug(sipe_debug_level level,
32 const gchar *format,
33 ...)
35 va_list ap;
37 va_start(ap, format);
39 if (purple_debug_is_enabled()) {
41 /* purple_debug doesn't have a vprintf-like API call :-( */
42 gchar *msg = g_strdup_vprintf(format, ap);
44 switch (level) {
45 case SIPE_DEBUG_LEVEL_INFO:
46 purple_debug_info("sipe", "%s\n", msg);
47 break;
48 case SIPE_DEBUG_LEVEL_WARNING:
49 purple_debug_warning("sipe", "%s\n", msg);
50 break;
51 case SIPE_DEBUG_LEVEL_ERROR:
52 purple_debug_error("sipe", "%s\n", msg);
53 break;
54 case SIPE_DEBUG_LEVEL_FATAL:
55 purple_debug_fatal("sipe", "%s\n", msg);
56 break;
58 g_free(msg);
61 va_end(ap);
65 Local Variables:
66 mode: c
67 c-file-style: "bsd"
68 indent-tabs-mode: t
69 tab-width: 8
70 End: