summaryrefslogtreecommitdiff
path: root/sbin/isakmpd/log.c
diff options
context:
space:
mode:
authorHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2004-02-25 16:01:30 +0000
committerHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2004-02-25 16:01:30 +0000
commita7946343fa1ef0c2bc26b1296b175f5aa2b57c78 (patch)
treeb7671b78e0dbbb7511afd2a731adeb3699e818f0 /sbin/isakmpd/log.c
parentfc8c3e27036aab4d3021f9c55fa0b1c90b4c1405 (diff)
Add and document configuration options Logverbose and Loglevel. As log.c now
depends on conf.c and some regression tests use log.c, add conf.c to Makefiles where necessary. ok ho@
Diffstat (limited to 'sbin/isakmpd/log.c')
-rw-r--r--sbin/isakmpd/log.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/sbin/isakmpd/log.c b/sbin/isakmpd/log.c
index 419512709b5..fcc9c217841 100644
--- a/sbin/isakmpd/log.c
+++ b/sbin/isakmpd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.39 2004/02/19 09:54:52 ho Exp $ */
+/* $OpenBSD: log.c,v 1.40 2004/02/25 16:01:28 hshoexer Exp $ */
/* $EOM: log.c,v 1.30 2000/09/29 08:19:23 niklas Exp $ */
/*
@@ -60,6 +60,7 @@
#include <stdarg.h>
#include <unistd.h>
+#include "conf.h"
#include "isakmp_num.h"
#include "log.h"
#include "monitor.h"
@@ -109,6 +110,50 @@ log_init (int debug)
}
void
+log_reinit (void)
+{
+ struct conf_list *logging;
+#ifdef USE_DEBUG
+ struct conf_list_node *logclass;
+ int class, level;
+#endif /* USE_DEBUG */
+
+ logging = conf_get_list ("General", "Logverbose");
+ if (logging)
+ {
+ verbose_logging = 1;
+ conf_free_list (logging);
+ }
+
+
+#ifdef USE_DEBUG
+ logging = conf_get_list ("General", "Loglevel");
+ if (logging)
+ {
+ for (logclass = TAILQ_FIRST (&logging->fields); logclass;
+ logclass = TAILQ_NEXT (logclass, link))
+ {
+ if (sscanf (logclass->field, "%d=%d", &class, &level) != 2)
+ {
+ if (sscanf (logclass->field, "A=%d", &level) == 1)
+ for (class = 0; class < LOG_ENDCLASS; class++)
+ log_debug_cmd (class, level);
+ else
+ {
+ log_print ("init: invalid logging class or level: %s",
+ logclass->field);
+ continue;
+ }
+ }
+ else
+ log_debug_cmd (class, level);
+ }
+ conf_free_list (logging);
+ }
+#endif /* USE_DEBUG */
+}
+
+void
log_to (FILE *f)
{
if (!log_output && f)