summaryrefslogtreecommitdiff
path: root/sbin/isakmpd/log.c
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>2000-02-25 17:23:43 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>2000-02-25 17:23:43 +0000
commit21910ef24718f8005826a8363b6fa6aea6cca145 (patch)
tree54ded622fa65f31f93fbcbd04d876345c6a13682 /sbin/isakmpd/log.c
parent47167191f09ba0d3c55764f63f6be1d9bcb1aa4b (diff)
regress/crypto/Makefile: Merge with EOM 1.5
regress/dh/Makefile: Merge with EOM 1.7 regress/group/Makefile: Merge with EOM 1.9 regress/prf/Makefile: Merge with EOM 1.4 regress/rsakeygen/Makefile: Merge with EOM 1.8 regress/x509/Makefile: Merge with EOM 1.10 Makefile: Merge with EOM 1.62 attribute.c: Merge with EOM 1.10 sa.c: Merge with EOM 1.99 conf.c: Merge with EOM 1.20 crypto.c: Merge with EOM 1.28 isakmpd.c: Merge with EOM 1.45 connection.c: Merge with EOM 1.19 doi.h: Merge with EOM 1.28 field.c: Merge with EOM 1.11 exchange.c: Merge with EOM 1.116 ike_auth.c: Merge with EOM 1.44 pf_key_v2.c: Merge with EOM 1.37 ike_phase_1.c: Merge with EOM 1.22 ipsec.c: Merge with EOM 1.118 isakmp_doi.c: Merge with EOM 1.40 log.c: Merge with EOM 1.26 log.h: Merge with EOM 1.18 math_group.c: Merge with EOM 1.23 message.c: Merge with EOM 1.144 pf_encap.c: Merge with EOM 1.70 policy.c: Merge with EOM 1.18 timer.c: Merge with EOM 1.13 transport.c: Merge with EOM 1.41 udp.c: Merge with EOM 1.47 ui.c: Merge with EOM 1.37 x509.c: Merge with EOM 1.36 author: niklas Made debug logging a compile time selectable feature
Diffstat (limited to 'sbin/isakmpd/log.c')
-rw-r--r--sbin/isakmpd/log.c60
1 files changed, 32 insertions, 28 deletions
diff --git a/sbin/isakmpd/log.c b/sbin/isakmpd/log.c
index 1f11934c9a6..3c45c62a3ae 100644
--- a/sbin/isakmpd/log.c
+++ b/sbin/isakmpd/log.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: log.c,v 1.8 1999/08/26 22:31:36 niklas Exp $ */
-/* $EOM: log.c,v 1.25 1999/08/12 23:08:55 niklas Exp $ */
+/* $OpenBSD: log.c,v 1.9 2000/02/25 17:23:40 niklas Exp $ */
+/* $EOM: log.c,v 1.26 2000/02/20 19:58:39 niklas Exp $ */
/*
* Copyright (c) 1998, 1999 Niklas Hallqvist. All rights reserved.
@@ -52,7 +52,9 @@
static void _log_print (int, int, const char *, va_list, int, int);
static FILE *log_output = stderr;
+#ifdef USE_DEBUG
static int log_level[LOG_ENDCLASS];
+#endif
void
log_to (FILE *f)
@@ -142,6 +144,7 @@ _log_print (int error, int syslog_level, const char *fmt, va_list ap,
syslog (class == LOG_REPORT ? LOG_ALERT : syslog_level, buffer);
}
+#ifdef USE_DEBUG
void
#ifdef __STDC__
log_debug (int cls, int level, const char *fmt, ...)
@@ -208,6 +211,33 @@ log_debug_buf (int cls, int level, const char *header, const u_int8_t *buf,
}
void
+log_debug_cmd (int cls, int level)
+{
+ if (cls < 0 || cls >= LOG_ENDCLASS)
+ {
+ log_print ("log_debug_cmd: invalid debugging class %d", cls);
+ return;
+ }
+
+ if (level < 0)
+ {
+ log_print ("log_debug_cmd: invalid debugging level %d for class %d",
+ level, cls);
+ return;
+ }
+
+ if (level == log_level[cls])
+ log_print ("log_debug_cmd: log level unchanged for class %d", cls);
+ else
+ {
+ log_print ("log_debug_cmd: log level changed from %d to %d for class %d",
+ log_level[cls], level, cls);
+ log_level[cls] = level;
+ }
+}
+#endif /* USE_DEBUG */
+
+void
#ifdef __STDC__
log_print (const char *fmt, ...)
#else
@@ -270,29 +300,3 @@ log_fatal (fmt, va_alist)
va_end (ap);
exit (1);
}
-
-void
-log_debug_cmd (int cls, int level)
-{
- if (cls < 0 || cls >= LOG_ENDCLASS)
- {
- log_print ("log_debug_cmd: invalid debugging class %d", cls);
- return;
- }
-
- if (level < 0)
- {
- log_print ("log_debug_cmd: invalid debugging level %d for class %d",
- level, cls);
- return;
- }
-
- if (level == log_level[cls])
- log_print ("log_debug_cmd: log level unchanged for class %d", cls);
- else
- {
- log_print ("log_debug_cmd: log level changed from %d to %d for class %d",
- log_level[cls], level, cls);
- log_level[cls] = level;
- }
-}