mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
log: set syslog facility to LOG_DAEMON when run in server mode
This commit is contained in:
parent
4f4ee5b39d
commit
55a23a5b29
3 changed files with 17 additions and 5 deletions
15
log.c
15
log.c
|
|
@ -13,16 +13,21 @@
|
|||
|
||||
static bool colorize = false;
|
||||
|
||||
static void __attribute__((constructor))
|
||||
init(void)
|
||||
void
|
||||
log_init(enum log_facility syslog_facility)
|
||||
{
|
||||
static const int facility_map[] = {
|
||||
[LOG_FACILITY_USER] = LOG_USER,
|
||||
[LOG_FACILITY_DAEMON] = LOG_DAEMON,
|
||||
};
|
||||
|
||||
colorize = isatty(STDOUT_FILENO);
|
||||
openlog(NULL, /*LOG_PID*/0, LOG_USER);
|
||||
openlog(NULL, /*LOG_PID*/0, facility_map[syslog_facility]);
|
||||
setlogmask(LOG_UPTO(LOG_WARNING));
|
||||
}
|
||||
|
||||
static void __attribute__((destructor))
|
||||
fini(void)
|
||||
void
|
||||
log_deinit(void)
|
||||
{
|
||||
closelog();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue