{
if (0 == strcasecmp (key, "LogLevel")) {
log_level = parse_log_severity(value);
- if (log_level == -1) return 1; /* to keep previous behaviour */
+ if (log_level < 0) {
+ log_level = LOG_INFO;
+ ERROR ("logfile: invalid loglevel [%s] defaulting to 'info'", value);
+ return (1);
+ }
}
else if (0 == strcasecmp (key, "File")) {
sfree (log_file);
cdtime_t timestamp_time)
{
FILE *fh;
- int do_close = 0;
+ _Bool do_close = 0;
struct tm timestamp_tm;
char timestamp_str[64];
char level_str[16] = "";
else
fprintf (fh, "%s%s\n", level_str, msg);
- if (do_close != 0)
+ if (do_close) {
fclose (fh);
+ } else {
+ fflush(fh);
+ }
}
pthread_mutex_unlock (&file_lock);
#define APPEND(bufptr, buflen, key, value) \
if ((buflen > 0) && (strlen (value) > 0)) { \
- int status = ssnprintf (bufptr, buflen, ", %s = %s", key, value); \
+ status = ssnprintf (bufptr, buflen, ", %s = %s", key, value); \
if (status > 0) { \
bufptr += status; \
buflen -= status; \