log: constructor/destructor to initialize/close syslog

This commit is contained in:
Daniel Eklöf 2019-01-26 14:52:56 +01:00
parent 1fe847cb4e
commit 453364e9f8

14
log.c
View file

@ -6,6 +6,20 @@
#include <stdbool.h>
#include <errno.h>
#include <syslog.h>
static void __attribute__((constructor))
init(void)
{
openlog(NULL, /*LOG_PID*/0, LOG_USER);
}
static void __attribute__((destructor))
fini(void)
{
closelog();
}
static void
_log(enum log_class log_class, const char *module, const char *file, int lineno,
const char *fmt, int sys_errno, va_list va)