X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Flogfile.c;h=fa56a1bcc95e790d5aac21d4aa42394fc5548835;hp=de9b1f75b19512632ef7a9649470fca5ac637620;hb=06a86a60a7dabc685bdbd81ce3d36ea5f7e2c2d4;hpb=3d082a905619c19ca5b7183bb95a30d4d9529c4d diff --git a/src/logfile.c b/src/logfile.c index de9b1f75..fa56a1bc 100644 --- a/src/logfile.c +++ b/src/logfile.c @@ -39,9 +39,9 @@ static int log_level = LOG_INFO; static pthread_mutex_t file_lock = PTHREAD_MUTEX_INITIALIZER; -static char *log_file = NULL; +static char *log_file; static int print_timestamp = 1; -static int print_severity = 0; +static int print_severity; static const char *config_keys[] = {"LogLevel", "File", "Timestamp", "PrintSeverity"}; @@ -77,7 +77,7 @@ static int logfile_config(const char *key, const char *value) { static void logfile_print(const char *msg, int severity, cdtime_t timestamp_time) { FILE *fh; - _Bool do_close = 0; + bool do_close = false; char timestamp_str[64]; char level_str[16] = ""; @@ -122,13 +122,12 @@ static void logfile_print(const char *msg, int severity, fh = stdout; else { fh = fopen(log_file, "a"); - do_close = 1; + do_close = true; } if (fh == NULL) { - char errbuf[1024]; fprintf(stderr, "logfile plugin: fopen (%s) failed: %s\n", log_file, - sstrerror(errno, errbuf, sizeof(errbuf))); + STRERRNO); } else { if (print_timestamp) fprintf(fh, "[%s] %s%s\n", timestamp_str, level_str, msg);