summaryrefslogtreecommitdiff
path: root/src/lib/logs.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2017-02-08 17:09:55 +0100
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2017-02-08 18:04:13 +0100
commit742d01a4f9a32f17561104ee7da8971c1bcdd703 (patch)
tree26a9c0b622b5bf875b783692837d1069799f8fcc /src/lib/logs.c
parent9117f7f6fec70f2da24e8e77256747d11d67bf8d (diff)
downloadouroboros-742d01a4f9a32f17561104ee7da8971c1bcdd703.tar.gz
ouroboros-742d01a4f9a32f17561104ee7da8971c1bcdd703.zip
lib: Log to the logging system
This removes the logfile and outputs log messages to the logging system. The creation of the logfiles (as well as the ap_init() call) were moved into ipcp_init() to simplify the IPCP creation and shutdown. Fixes #25 Fixes #27
Diffstat (limited to 'src/lib/logs.c')
-rw-r--r--src/lib/logs.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/logs.c b/src/lib/logs.c
index 449ee191..3184773f 100644
--- a/src/lib/logs.c
+++ b/src/lib/logs.c
@@ -3,7 +3,8 @@
*
* Logging facilities
*
- * Sander Vrijders <sander.vrijders@intec.ugent.be>
+ * Sander Vrijders <sander.vrijders@intec.ugent.be>
+ * Dimitri Staessens <dimitri.staessens@intec.ugent.be>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -24,19 +25,18 @@
#include <ouroboros/logs.h>
-FILE * logfile = NULL;
+bool log_syslog;
-int set_logfile(char * filename)
+void log_init(bool sysout)
{
- logfile = fopen(filename, "w");
- if (logfile == NULL)
- return -1;
+ log_syslog = sysout;
- return 0;
+ if (log_syslog)
+ openlog(NULL, LOG_PID, LOG_DAEMON);
}
-void close_logfile()
+void log_fini(void)
{
- if (logfile != NULL)
- fclose(logfile);
+ if (log_syslog)
+ closelog();
}