mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-26 23:25:56 -05:00
Always log E_LOG or higher to syslog, closing #137
This commit is contained in:
parent
ebeaed447e
commit
c926c05c6e
10
src/err.c
10
src/err.c
@ -58,6 +58,7 @@ static FILE *err_file=NULL; /**< if logging to file, the handle of that file */
|
|||||||
static pthread_mutex_t err_mutex=PTHREAD_MUTEX_INITIALIZER; /**< for serializing log messages */
|
static pthread_mutex_t err_mutex=PTHREAD_MUTEX_INITIALIZER; /**< for serializing log messages */
|
||||||
static unsigned int err_debugmask=0xFFFFFFFF; /**< modules to debug, see \ref log_categories */
|
static unsigned int err_debugmask=0xFFFFFFFF; /**< modules to debug, see \ref log_categories */
|
||||||
static int err_truncate = 0;
|
static int err_truncate = 0;
|
||||||
|
static int err_syslog_open = 0;
|
||||||
|
|
||||||
/** text list of modules to match for setting debug mask */
|
/** text list of modules to match for setting debug mask */
|
||||||
static char *err_categorylist[] = {
|
static char *err_categorylist[] = {
|
||||||
@ -150,11 +151,12 @@ void err_log(int level, unsigned int cat, char *fmt, ...)
|
|||||||
if(!level) fprintf(stderr,"Aborting\n");
|
if(!level) fprintf(stderr,"Aborting\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* alwyas log fatals to syslog */
|
/* always log fatals and level 1 to syslog */
|
||||||
if(!level) {
|
if(level <= 1) {
|
||||||
os_opensyslog(); // (app,LOG_PID,LOG_DAEMON);
|
if(!err_syslog_open)
|
||||||
|
os_opensyslog();
|
||||||
|
err_syslog_open=1;
|
||||||
os_syslog(level,errbuf);
|
os_syslog(level,errbuf);
|
||||||
os_closesyslog();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_err_unlock();
|
_err_unlock();
|
||||||
|
Loading…
Reference in New Issue
Block a user