Use the default debug hook if possible

This commit is contained in:
Martin Willi
2009-09-16 13:16:00 +02:00
parent 5289249449
commit b538b606da
6 changed files with 3 additions and 47 deletions
-17
View File
@@ -589,22 +589,6 @@ static void cleanup(void)
DESTROY_IF(end); 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[]) int main(int argc, char *argv[])
{ {
char *uri, *name = "", *filter = ""; char *uri, *name = "", *filter = "";
@@ -620,7 +604,6 @@ int main(int argc, char *argv[])
OP_PURGE, OP_PURGE,
} operation = OP_USAGE; } operation = OP_USAGE;
dbg = dbg_stderr;
atexit(library_deinit); atexit(library_deinit);
/* initialize library */ /* initialize library */
-1
View File
@@ -14,7 +14,6 @@
*/ */
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h>
#include "debug.h" #include "debug.h"
+2
View File
@@ -21,6 +21,8 @@
#ifndef DEBUG_H_ #ifndef DEBUG_H_
#define DEBUG_H_ #define DEBUG_H_
#include <stdio.h>
#ifndef DEBUG_LEVEL #ifndef DEBUG_LEVEL
# define DEBUG_LEVEL 4 # define DEBUG_LEVEL 4
#endif /* DEBUG_LEVEL */ #endif /* DEBUG_LEVEL */
+1 -1
View File
@@ -124,7 +124,7 @@ int command_getopt(char **arg)
} }
continue; continue;
case 'v': case 'v':
dbg_level = atoi(optarg); dbg_default_set_level(atoi(optarg));
continue; continue;
default: default:
*arg = optarg; *arg = optarg;
-23
View File
@@ -18,27 +18,6 @@
#include <debug.h> #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 * Convert a form string to a encoding type
*/ */
@@ -101,8 +80,6 @@ hash_algorithm_t get_digest(char *name)
*/ */
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
dbg = dbg_pki;
atexit(library_deinit); atexit(library_deinit);
if (!library_init(NULL)) if (!library_init(NULL))
{ {
-5
View File
@@ -26,11 +26,6 @@
#include <library.h> #include <library.h>
#include <credentials/keys/private_key.h> #include <credentials/keys/private_key.h>
/**
* Defines the settable debug level
*/
extern int dbg_level;
/** /**
* Convert a form string to a encoding type * Convert a form string to a encoding type
*/ */