X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=secnet.git;a=blobdiff_plain;f=log.c;h=3a50a27ce47ab301ae317353f800fed9a2986b8b;hp=c2da4af09b3713dd6d0ec6835d65676538b5e4f3;hb=9b8369e07aeba5ed2c69fb4a7f74d07c8cebe015;hpb=fe5e9cc422cd72526ccfceffbc7e5af8ac83b407 diff --git a/log.c b/log.c index c2da4af..3a50a27 100644 --- a/log.c +++ b/log.c @@ -8,6 +8,7 @@ #include #include #include "process.h" +#include "util.h" bool_t secnet_is_daemon=False; uint32_t message_level=M_WARNING|M_ERR|M_SECURITY|M_FATAL; @@ -18,17 +19,18 @@ static void vMessage(uint32_t class, const char *message, va_list args) FILE *dest=stdout; #define MESSAGE_BUFLEN 1023 static char buff[MESSAGE_BUFLEN+1]={0,}; - uint32_t bp; + size_t bp; char *nlp; - if (secnet_is_daemon) { + if (system_log) { /* Messages go to the system log interface */ bp=strlen(buff); + assert(bp < MESSAGE_BUFLEN); vsnprintf(buff+bp,MESSAGE_BUFLEN-bp,message,args); /* Each line is sent separately */ while ((nlp=strchr(buff,'\n'))) { *nlp=0; - log(system_log,class,buff); + slilog(system_log,class,"%s",buff); memmove(buff,nlp+1,strlen(nlp+1)+1); } } else { @@ -486,8 +488,7 @@ struct fdlog { }; static int log_from_fd_beforepoll(void *sst, struct pollfd *fds, int *nfds_io, - int *timeout_io, - const struct timeval *tv_now, uint64_t *now) + int *timeout_io) { struct fdlog *st=sst; if (!st->finished) { @@ -498,8 +499,7 @@ static int log_from_fd_beforepoll(void *sst, struct pollfd *fds, int *nfds_io, return 0; } -static void log_from_fd_afterpoll(void *sst, struct pollfd *fds, int nfds, - const struct timeval *tv_now, uint64_t *now) +static void log_from_fd_afterpoll(void *sst, struct pollfd *fds, int nfds) { struct fdlog *st=sst; int r,remain,i; @@ -554,7 +554,6 @@ void log_from_fd(int fd, cstring_t prefix, struct log_if *log) prefix); } -init_module log_module; void log_module(dict_t *dict) { add_closure(dict,"logfile",logfile_apply);