log.c: remove superfluous uses of #ifdef HAVE_SYSLOG_H
When this code is hit, availability of syslog has already been checked (when reading the config file). So config.syslog == TRUE only when HAVE_SYSLOG_H is defined. So I remove the preprocessor checks which only clobber the logic and make the code harder to read (IMHO). Michael
This commit is contained in:
parent
2c14f89bfc
commit
f3c8424515
14
src/log.c
14
src/log.c
@ -128,10 +128,8 @@ void log_message (int level, const char *fmt, ...)
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SYSLOG_H
|
|
||||||
if (config.syslog && level == LOG_CONN)
|
if (config.syslog && level == LOG_CONN)
|
||||||
level = LOG_INFO;
|
level = LOG_INFO;
|
||||||
#endif
|
|
||||||
|
|
||||||
va_start (args, fmt);
|
va_start (args, fmt);
|
||||||
|
|
||||||
@ -161,16 +159,15 @@ void log_message (int level, const char *fmt, ...)
|
|||||||
safefree (entry_buffer);
|
safefree (entry_buffer);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_SYSLOG_H
|
|
||||||
if (config.syslog) {
|
if (config.syslog) {
|
||||||
# ifdef HAVE_VSYSLOG_H
|
#ifdef HAVE_VSYSLOG_H
|
||||||
vsyslog (level, fmt, args);
|
vsyslog (level, fmt, args);
|
||||||
# else
|
#else
|
||||||
vsnprintf (str, STRING_LENGTH, fmt, args);
|
vsnprintf (str, STRING_LENGTH, fmt, args);
|
||||||
syslog (level, "%s", str);
|
syslog (level, "%s", str);
|
||||||
# endif
|
|
||||||
} else {
|
|
||||||
#endif
|
#endif
|
||||||
|
} else {
|
||||||
nowtime = time (NULL);
|
nowtime = time (NULL);
|
||||||
/* Format is month day hour:minute:second (24 time) */
|
/* Format is month day hour:minute:second (24 time) */
|
||||||
strftime (time_string, TIME_LENGTH, "%b %d %H:%M:%S",
|
strftime (time_string, TIME_LENGTH, "%b %d %H:%M:%S",
|
||||||
@ -202,10 +199,7 @@ void log_message (int level, const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fsync (log_file_fd);
|
fsync (log_file_fd);
|
||||||
|
|
||||||
#ifdef HAVE_SYSLOG_H
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
Loading…
Reference in New Issue
Block a user