From 3cc74d37d020513a75385abd9b9fbef55440628a Mon Sep 17 00:00:00 2001 From: Thomas Ries Date: Fri, 23 Jun 2006 21:45:31 +0000 Subject: [PATCH] - logging --- doc/siproxd.conf.example | 8 +++++--- src/log.c | 10 +++++----- src/log.h | 8 ++++---- src/siproxd.h | 2 +- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/doc/siproxd.conf.example b/doc/siproxd.conf.example index 0031a43..b9193f4 100644 --- a/doc/siproxd.conf.example +++ b/doc/siproxd.conf.example @@ -193,9 +193,11 @@ default_expires = 600 # DBCLASS_DNS 0x00000040 // DNS stuff # DBCLASS_NETTRAF 0x00000080 // network traffic # DBCLASS_CONFIG 0x00000100 // configuration -# DBCLASS_RTP 0x00000200 // RTP proxy -# DBCLASS_ACCESS 0x00000400 // Access list evaluation -# DBCLASS_AUTH 0x00000800 // Authentication +# DBCLASS_RTP 0x00000200 // RTP proxy +# DBCLASS_ACCESS 0x00000400 // Access list evaluation +# DBCLASS_AUTH 0x00000800 // Authentication +# DBCLASS_PLUGIN 0x00001000 // Plugins +# DCLASS_RTPBABL 0x00002000 // RTP babble # debug_level = 0x00000000 diff --git a/src/log.c b/src/log.c index 3912b5a..4878d13 100644 --- a/src/log.c +++ b/src/log.c @@ -43,7 +43,7 @@ static char const ident[]="$Id$"; /* module local variables */ static int log_to_stderr=0; -static int debug_pattern=0; +static unsigned int debug_pattern=0; static int debug_listen_port=0; static int debug_listen_fd=0; @@ -66,12 +66,12 @@ static int silence_level=1; */ static pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER; -void log_set_pattern(int pattern) { +void log_set_pattern(unsigned int pattern) { debug_pattern=pattern; return; } -int log_get_pattern(void) { +unsigned int log_get_pattern(void) { return debug_pattern; } @@ -209,7 +209,7 @@ void log_tcp_connect(void) { */ -void log_debug(int class, char *file, int line, const char *format, ...) { +void log_debug(unsigned int class, char *file, int line, const char *format, ...) { va_list ap, ap_copy; time_t t; struct tm *tim; @@ -437,7 +437,7 @@ void log_info(char *file, int line, const char *format, ...) { } -void log_dump_buffer(int class, char *file, int line, +void log_dump_buffer(unsigned int class, char *file, int line, char *buffer, int length) { int i, j; char tmp[8], tmplin1[80], tmplin2[80]; diff --git a/src/log.h b/src/log.h index 8616ab5..7320222 100644 --- a/src/log.h +++ b/src/log.h @@ -39,8 +39,8 @@ #define DBCLASS_ALL 0xffffffff /* All classes */ -void log_set_pattern(int pattern); -int log_get_pattern(void); +void log_set_pattern(unsigned int pattern); +unsigned int log_get_pattern(void); void log_set_stderr(int tostdout); void log_set_silence(int level); void log_set_listen_port(int port); @@ -58,7 +58,7 @@ void log_tcp_connect(void); #define DEBUG(F...) log_debug(1,__FILE__, __LINE__,F) #define DEBUGC(C,F...) log_debug(C,__FILE__, __LINE__,F) -void log_debug(int class, char *file, int line, const char *format, ...) GNUC_PRINTF(4, 5); +void log_debug(unsigned int class, char *file, int line, const char *format, ...) GNUC_PRINTF(4, 5); #define ERROR(F...) log_error(__FILE__, __LINE__,F) void log_error(char *file, int line, const char *format, ...) GNUC_PRINTF(3, 4); @@ -71,5 +71,5 @@ void log_info(char *file, int line, const char *format, ...) GNUC_PRINTF(3, 4); /* tobedone: dump a buffer */ #define DUMP_BUFFER(C,F,L) log_dump_buffer(C,__FILE__, __LINE__,F,L) -void log_dump_buffer(int class, char *file, int line, +void log_dump_buffer(unsigned int class, char *file, int line, char *buffer, int length); diff --git a/src/siproxd.h b/src/siproxd.h index 2dea229..050e16f 100644 --- a/src/siproxd.h +++ b/src/siproxd.h @@ -56,7 +56,7 @@ typedef struct { * configuration option table */ struct siproxd_config { - int debuglevel; + unsigned int debuglevel; int debugport; char *inbound_if; char *outbound_if;