forked from external/yambar
log: constructor/destructor to initialize/close syslog
This commit is contained in:
parent
1fe847cb4e
commit
453364e9f8
1 changed files with 14 additions and 0 deletions
14
log.c
14
log.c
|
@ -6,6 +6,20 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <errno.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
|
static void
|
||||||
_log(enum log_class log_class, const char *module, const char *file, int lineno,
|
_log(enum log_class log_class, const char *module, const char *file, int lineno,
|
||||||
const char *fmt, int sys_errno, va_list va)
|
const char *fmt, int sys_errno, va_list va)
|
||||||
|
|
Loading…
Add table
Reference in a new issue