aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2009-09-16 13:16:00 +0200
committerMartin Willi <martin@strongswan.org>2009-09-16 13:16:00 +0200
commitb538b606da7f4e10ec2a60046c726dc74b6e030f (patch)
tree94355b0ffaf36536931c730de001a8e44d363590 /src
parent5289249449e0e6792cdbc014ec7bc03a0c179354 (diff)
downloadstrongswan-b538b606da7f4e10ec2a60046c726dc74b6e030f.tar.bz2
strongswan-b538b606da7f4e10ec2a60046c726dc74b6e030f.tar.xz
Use the default debug hook if possible
Diffstat (limited to 'src')
-rw-r--r--src/charon/plugins/sql/pool.c17
-rw-r--r--src/libstrongswan/debug.c1
-rw-r--r--src/libstrongswan/debug.h2
-rw-r--r--src/pki/command.c2
-rw-r--r--src/pki/pki.c23
-rw-r--r--src/pki/pki.h5
6 files changed, 3 insertions, 47 deletions
diff --git a/src/charon/plugins/sql/pool.c b/src/charon/plugins/sql/pool.c
index 55d82dac7..68c2dac48 100644
--- a/src/charon/plugins/sql/pool.c
+++ b/src/charon/plugins/sql/pool.c
@@ -589,22 +589,6 @@ static void cleanup(void)
DESTROY_IF(end);
}
-/**
- * Logging hook for library logs, using stderr output
- */
-static void dbg_stderr(int level, char *fmt, ...)
-{
- va_list args;
-
- if (level <= 1)
- {
- va_start(args, fmt);
- vfprintf(stderr, fmt, args);
- fprintf(stderr, "\n");
- va_end(args);
- }
-}
-
int main(int argc, char *argv[])
{
char *uri, *name = "", *filter = "";
@@ -620,7 +604,6 @@ int main(int argc, char *argv[])
OP_PURGE,
} operation = OP_USAGE;
- dbg = dbg_stderr;
atexit(library_deinit);
/* initialize library */
diff --git a/src/libstrongswan/debug.c b/src/libstrongswan/debug.c
index 5bd4243d7..51b7875d8 100644
--- a/src/libstrongswan/debug.c
+++ b/src/libstrongswan/debug.c
@@ -14,7 +14,6 @@
*/
#include <stdarg.h>
-#include <stdio.h>
#include "debug.h"
diff --git a/src/libstrongswan/debug.h b/src/libstrongswan/debug.h
index c3b71cee3..085795acb 100644
--- a/src/libstrongswan/debug.h
+++ b/src/libstrongswan/debug.h
@@ -21,6 +21,8 @@
#ifndef DEBUG_H_
#define DEBUG_H_
+#include <stdio.h>
+
#ifndef DEBUG_LEVEL
# define DEBUG_LEVEL 4
#endif /* DEBUG_LEVEL */
diff --git a/src/pki/command.c b/src/pki/command.c
index 8f5bc14f8..246ddfe43 100644
--- a/src/pki/command.c
+++ b/src/pki/command.c
@@ -124,7 +124,7 @@ int command_getopt(char **arg)
}
continue;
case 'v':
- dbg_level = atoi(optarg);
+ dbg_default_set_level(atoi(optarg));
continue;
default:
*arg = optarg;
diff --git a/src/pki/pki.c b/src/pki/pki.c
index 0642bedc3..0912d5051 100644
--- a/src/pki/pki.c
+++ b/src/pki/pki.c
@@ -19,27 +19,6 @@
#include <debug.h>
/**
- * Default debug level
- */
-int dbg_level = 1;
-
-/**
- * Logging to stderr with configurable debug level
- */
-void dbg_pki(int level, char *fmt, ...)
-{
- if (level <= dbg_level)
- {
- va_list args;
-
- va_start(args, fmt);
- vfprintf(stderr, fmt, args);
- fprintf(stderr, "\n");
- va_end(args);
- }
-}
-
-/**
* Convert a form string to a encoding type
*/
bool get_form(char *form, key_encoding_type_t *type, bool pub)
@@ -101,8 +80,6 @@ hash_algorithm_t get_digest(char *name)
*/
int main(int argc, char *argv[])
{
- dbg = dbg_pki;
-
atexit(library_deinit);
if (!library_init(NULL))
{
diff --git a/src/pki/pki.h b/src/pki/pki.h
index 135749d47..893ab52e2 100644
--- a/src/pki/pki.h
+++ b/src/pki/pki.h
@@ -27,11 +27,6 @@
#include <credentials/keys/private_key.h>
/**
- * Defines the settable debug level
- */
-extern int dbg_level;
-
-/**
* Convert a form string to a encoding type
*/
bool get_form(char *form, key_encoding_type_t *type, bool pub);