From ae4821d5f5afbf7e861916debb5bfc1667083eee Mon Sep 17 00:00:00 2001 From: ehouse Date: Sun, 30 Oct 2005 05:10:26 +0000 Subject: [PATCH] don't print log messages below a certain priority --- relay/xwrelay.cpp | 33 ++++++++++++++++----------------- relay/xwrelay_priv.h | 6 ++++-- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/relay/xwrelay.cpp b/relay/xwrelay.cpp index a11889d19..340c9fd43 100644 --- a/relay/xwrelay.cpp +++ b/relay/xwrelay.cpp @@ -59,29 +59,28 @@ #include "timermgr.h" #include "permid.h" -#define N_WORKER_THREADS 5 -#define MILLIS 1000 - void logf( XW_LogLevel level, const char* format, ... ) { - FILE* where = stderr; - struct tm* timp; - struct timeval tv; - struct timezone tz; - gettimeofday( &tv, &tz ); - timp = localtime( &tv.tv_sec ); + if ( level <= XW_LOGINFO ) { + FILE* where = stderr; + struct tm* timp; + struct timeval tv; + struct timezone tz; + gettimeofday( &tv, &tz ); + timp = localtime( &tv.tv_sec ); - pthread_t me = pthread_self(); + pthread_t me = pthread_self(); - fprintf( where, "<%lx>%d:%d:%d: ", me, timp->tm_hour, timp->tm_min, - timp->tm_sec ); + fprintf( where, "<%lx>%d:%d:%d: ", me, timp->tm_hour, timp->tm_min, + timp->tm_sec ); - va_list ap; - va_start( ap, format ); - vfprintf( where, format, ap ); - va_end(ap); - fprintf( where, "\n" ); + va_list ap; + va_start( ap, format ); + vfprintf( where, format, ap ); + va_end(ap); + fprintf( where, "\n" ); + } } /* logf */ static int diff --git a/relay/xwrelay_priv.h b/relay/xwrelay_priv.h index 7d5fe4220..d3695c242 100644 --- a/relay/xwrelay_priv.h +++ b/relay/xwrelay_priv.h @@ -8,8 +8,10 @@ typedef unsigned char HostID; typedef enum { - XW_LOGINFO - ,XW_LOGERROR + XW_LOGERROR + ,XW_LOGINFO + ,XW_LOGVERBOSE0 + ,XW_LOGVERBOSE1 } XW_LogLevel; void logf( XW_LogLevel level, const char* format, ... );