3db58ba748b45f7767573b4763fd283a4f739c4d
[strongswan.git] / src / libstrongswan / debug.c
1 /*
2 * Copyright (C) 2006 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 #include <stdarg.h>
17 #include <stdio.h>
18
19 #include "debug.h"
20
21 /**
22 * default dbg function which printf all to stderr
23 */
24 void dbg_default(int level, char *fmt, ...)
25 {
26 if (level <= 1)
27 {
28 va_list args;
29
30 va_start(args, fmt);
31 vfprintf(stderr, fmt, args);
32 fprintf(stderr, "\n");
33 va_end(args);
34 }
35 }
36
37 void (*dbg) (int level, char *fmt, ...) = dbg_default;