X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=src%2Flog.c;h=e3af295e4c42cbabadb8e023f6d99bfabe94e7d8;hb=HEAD;hp=4dc53f78124b08c621abd33f8123b31fa7e77309;hpb=f3ca90e517a9ae54e831e5a5b91fcc2afb9df5bf;p=tlsproxy%2Ftlsproxy.git diff --git a/src/log.c b/src/log.c index 4dc53f7..e3af295 100644 --- a/src/log.c +++ b/src/log.c @@ -1,7 +1,7 @@ /* * Log related functions/defines. * - * Copyright (C) 2011-2013 Simon Ruderich + * Copyright (C) 2011-2014 Simon Ruderich * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,9 +33,10 @@ void log_message(int level, const char *file, int line, const char *format, ...) } switch (level) { - case LOG_ERROR_LEVEL: level_string = "ERROR"; break; - case LOG_WARNING_LEVEL: level_string = "WARN "; break; - case LOG_DEBUG1_LEVEL: level_string = "DEBUG"; break; + case LOG_ERROR_LEVEL: level_string = "ERROR "; break; + case LOG_WARNING_LEVEL: level_string = " WARN "; break; + case LOG_DEBUG1_LEVEL: level_string = "DEBUG1"; break; + case LOG_DEBUG2_LEVEL: level_string = "DEBUG2"; break; default: level_string = "UNKNOWN"; } @@ -45,18 +46,13 @@ void log_message(int level, const char *file, int line, const char *format, ...) (void)line; #endif - /* Prevent another thread from interrupting the two printfs(). */ + /* Prevent another thread from interrupting the printfs(). */ flockfile(stderr); - fprintf(stderr, #ifdef DEBUG - "%-12s:%-3d " + fprintf(stderr, "%-12s:%-4d ", file, line); #endif - "[%s] [%d] ", -#ifdef DEBUG - file, line, -#endif - level_string, (int)pthread_self()); + fprintf(stderr, "[%s] [%ld] ", level_string, (long)pthread_self()); va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap);