order backend cmd options; open syslog only if syslog is enabled

This commit is contained in:
Olof Hagsand 2018-08-01 07:13:33 +00:00
parent 0355942740
commit 656800cdd3
2 changed files with 18 additions and 15 deletions

View file

@ -89,11 +89,14 @@ clicon_log_init(char *ident,
int upto,
int flags)
{
if (setlogmask(LOG_UPTO(upto)) < 0)
/* Cant syslog here */
fprintf(stderr, "%s: setlogmask: %s\n", __FUNCTION__, strerror(errno));
_logflags = flags;
openlog(ident, LOG_PID, LOG_USER); /* LOG_PUSER is achieved by direct stderr logs in clicon_log */
if (flags & CLICON_LOG_SYSLOG){
if (setlogmask(LOG_UPTO(upto)) < 0)
/* Cant syslog here */
fprintf(stderr, "%s: setlogmask: %s\n", __FUNCTION__, strerror(errno));
openlog(ident, LOG_PID, LOG_USER); /* LOG_PUSER is achieved by direct stderr logs in clicon_log */
}
return 0;
}