summaryrefslogtreecommitdiff
path: root/src/common/log.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2002-06-26 22:45:49 +0000
committerRoger Dingledine <arma@torproject.org>2002-06-26 22:45:49 +0000
commit9a928eeb1215f0d7c9b6d0bb9e4571d0a16ed79a (patch)
treefac560bf2dce8a8d2b82e296b71ff24f59ab1a7a /src/common/log.c
parent766a465a6043ac4e643c398feb14f708fd0d863f (diff)
downloadtor-9a928eeb1215f0d7c9b6d0bb9e4571d0a16ed79a.tar.gz
tor-9a928eeb1215f0d7c9b6d0bb9e4571d0a16ed79a.zip
Initial revision
svn:r2
Diffstat (limited to 'src/common/log.c')
-rw-r--r--src/common/log.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/common/log.c b/src/common/log.c
new file mode 100644
index 0000000000..e85f2c9464
--- /dev/null
+++ b/src/common/log.c
@@ -0,0 +1,74 @@
+/*
+ * log.c
+ * Logging facilities.
+ *
+ * Matej Pfajfar <mp292@cam.ac.uk>
+ */
+
+/*
+ * Changes :
+ * $Log$
+ * Revision 1.1 2002/06/26 22:45:50 arma
+ * Initial revision
+ *
+ * Revision 1.11 2002/06/14 20:44:57 mp292
+ * *** empty log message ***
+ *
+ * Revision 1.10 2002/03/12 23:31:36 mp292
+ * *** empty log message ***
+ *
+ * Revision 1.9 2002/03/02 18:55:50 mp292
+ * LOG_DEBUG messages don't print the last errno error anymore.
+ *
+ * Revision 1.8 2002/01/26 22:46:48 mp292
+ * Reviewd according to Secure-Programs-HOWTO.
+ *
+ * Revision 1.7 2002/01/17 15:00:43 mp292
+ * Fixed a bug which caused malloc() generate a seg fault.
+ *
+ * Revision 1.6 2001/12/12 16:02:55 badbytes
+ * Minor changes in output format.
+ *
+ * Revision 1.5 2001/12/12 06:48:07 badbytes
+ * Correction - last error message now only shown if severity==LOG_DEBUG.
+ *
+ * Revision 1.4 2001/12/12 06:28:46 badbytes
+ * Modified log() to print error message for last error in addition to the user-specified message.
+ *
+ * Revision 1.3 2001/12/07 09:38:03 badbytes
+ * Tested.
+ *
+ * Revision 1.2 2001/12/06 15:43:50 badbytes
+ * config.c compiles. Proceeding to test it.
+ *
+ * Revision 1.1 2001/11/21 23:03:41 mp292
+ * log function coded and tested.
+ * Top-level makefile.
+ *
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <syslog.h>
+#include <string.h>
+#include <errno.h>
+#include "log.h"
+
+void log_internal(int severity, const char *format, va_list ap);
+
+/* Outputs a message to stdout */
+void log(int severity, const char *format, ...)
+{
+ extern int loglevel;
+ va_list ap;
+
+ va_start(ap,format);
+
+ if (severity <= loglevel)
+ {
+ vprintf(format,ap);
+ printf("\n");
+ }
+
+ va_end(ap);
+}