From: Simon Ruderich Date: Sat, 10 Aug 2013 10:56:12 +0000 (+0200) Subject: Split log level DEBUG1 into DEBUG1 and DEBUG2. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=da3b5fdb4d8c70bea3bc4d2a9b5e4eab737864eb;p=tlsproxy%2Ftlsproxy.git Split log level DEBUG1 into DEBUG1 and DEBUG2. --- diff --git a/src/connection.c b/src/connection.c index c91eae3..7a6c082 100644 --- a/src/connection.c +++ b/src/connection.c @@ -149,7 +149,7 @@ void handle_connection(int client_socket) { goto out; } - LOG(DEBUG1, "target: %s:%s (HTTP 1.%d)", host, port, version_minor); + LOG(DEBUG2, "target: %s:%s (HTTP 1.%d)", host, port, version_minor); /* Connect to proxy server or directly to server. */ if (global_proxy_host != NULL && global_proxy_port != NULL) { @@ -628,7 +628,7 @@ static void transfer_data(int client, int server) { fds[1].events = POLLIN | POLLPRI | POLLHUP | POLLERR; fds[1].revents = 0; - LOG(DEBUG1, "transfer_data(): %d -> %d", client, server); + LOG(DEBUG2, "transfer_data(): %d -> %d", client, server); for (;;) { int result = poll(fds, 2 /* fd count */, -1 /* no timeout */); @@ -713,7 +713,7 @@ static void transfer_data_tls(int client, int server, if (gnutls_record_get_max_size(server_session) < buffer_size) { buffer_size = gnutls_record_get_max_size(server_session); } - LOG(DEBUG1, "transfer_data_tls(): suggested buffer size: %ld", + LOG(DEBUG2, "transfer_data_tls(): suggested buffer size: %ld", (long int)buffer_size); for (;;) { diff --git a/src/log.c b/src/log.c index b3c2083..84e08ba 100644 --- a/src/log.c +++ b/src/log.c @@ -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"; } diff --git a/src/log.h b/src/log.h index 9abb49f..4122e88 100644 --- a/src/log.h +++ b/src/log.h @@ -24,11 +24,13 @@ #define ERROR LOG_ERROR_LEVEL, __FILE__, __LINE__ #define WARNING LOG_WARNING_LEVEL, __FILE__, __LINE__ #define DEBUG1 LOG_DEBUG1_LEVEL, __FILE__, __LINE__ +#define DEBUG2 LOG_DEBUG2_LEVEL, __FILE__, __LINE__ /* Log level constants. */ #define LOG_ERROR_LEVEL 0 #define LOG_WARNING_LEVEL 1 #define LOG_DEBUG1_LEVEL 2 +#define LOG_DEBUG2_LEVEL 3 /* Call log_message() and print current file and line number. */ #define LOG \ diff --git a/src/tlsproxy.c b/src/tlsproxy.c index 1ccee20..7745930 100644 --- a/src/tlsproxy.c +++ b/src/tlsproxy.c @@ -258,7 +258,7 @@ static void parse_arguments(int argc, char **argv) { /* Default values. */ thread_count = 10; #ifdef DEBUG - global_log_level = LOG_DEBUG1_LEVEL; + global_log_level = LOG_DEBUG2_LEVEL; #else global_log_level = LOG_WARNING_LEVEL; #endif @@ -356,7 +356,7 @@ static void print_usage(const char *argv) { argv); fprintf(stderr, "\n"); fprintf(stderr, "-a digest authentication file [default: none]\n"); - fprintf(stderr, "-d debug level: 0=errors only, 2=debug [default: 1]\n"); + fprintf(stderr, "-d debug level: 0=errors only, 2=debug, 3=more debug [default: 1]\n"); fprintf(stderr, "-p proxy hostname and port\n"); fprintf(stderr, "-t number of threads [default: 10]\n"); fprintf(stderr, "-u passthrough connection if no certificate is stored \