X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=src%2Flog.c;h=02cadd200d7bc6dd8f5460f19435d11af16c4d67;hb=d0b5d139253e5c599c9e675fc0a5677bda5a5a29;hp=5d05e4addf461c05f5cdae8302e2037cd2badd17;hpb=d778944d0403b093d43d9cbd94bd298bfc3a8d42;p=tlsproxy%2Ftlsproxy.git diff --git a/src/log.c b/src/log.c index 5d05e4a..02cadd2 100644 --- a/src/log.c +++ b/src/log.c @@ -20,10 +20,8 @@ #include "tlsproxy.h" #include "log.h" -/* va_*() */ -#include -/* pthread_self() */ #include +#include void log_message(int level, const char *file, int line, const char *format, ...) { @@ -41,14 +39,22 @@ void log_message(int level, const char *file, int line, const char *format, ...) default: level_string = "UNKNOWN"; } - va_start(ap, format); -#ifdef DEBUG - fprintf(stdout, "%-12s:%-3d ", file, line); -#else +#ifndef DEBUG + /* Prevent warnings. */ (void)file; (void)line; #endif - fprintf(stdout, "[%s] [%d] ", level_string, (int)pthread_self()); + + va_start(ap, format); + fprintf(stdout, +#ifdef DEBUG + "%-12s:%-3d " +#endif + "[%s] [%d] ", +#ifdef DEBUG + file, line, +#endif + level_string, (int)pthread_self()); vfprintf(stdout, format, ap); fprintf(stdout, "\n"); va_end(ap);