aboutsummaryrefslogtreecommitdiffstats
path: root/src/pki/pki.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pki/pki.c')
-rw-r--r--src/pki/pki.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/pki/pki.c b/src/pki/pki.c
index c1a070292..0642bedc3 100644
--- a/src/pki/pki.c
+++ b/src/pki/pki.c
@@ -16,6 +16,29 @@
#include "command.h"
#include "pki.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
*/
@@ -78,6 +101,8 @@ hash_algorithm_t get_digest(char *name)
*/
int main(int argc, char *argv[])
{
+ dbg = dbg_pki;
+
atexit(library_deinit);
if (!library_init(NULL))
{