mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-27 09:58:45 +01:00
don't print log messages below a certain priority
This commit is contained in:
parent
f6f5e6eaf0
commit
ae4821d5f5
2 changed files with 20 additions and 19 deletions
|
@ -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
|
||||
|
|
|
@ -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, ... );
|
||||
|
|
Loading…
Reference in a new issue