send libevent's warning messages to our logging framework instead of to the console

This commit is contained in:
Charles Kerr 2007-08-19 03:54:27 +00:00
parent b0919dca34
commit e19ecccae8
1 changed files with 18 additions and 0 deletions

View File

@ -115,6 +115,23 @@ readFromPipe( int fd, short eventType UNUSED, void * unused UNUSED )
}
}
static void
logFunc( int severity, const char * message )
{
switch( severity )
{
case _EVENT_LOG_DEBUG:
tr_dbg( "%s", message );
break;
case _EVENT_LOG_ERR:
tr_err( "%s", message );
break;
default:
tr_inf( "%s", message );
break;
}
}
static void
libeventThreadFunc( void * veh )
{
@ -122,6 +139,7 @@ libeventThreadFunc( void * veh )
tr_dbg( "libevent thread starting" );
event_init( );
event_set_log_callback( logFunc );
/* listen to the pipe's read fd */
event_set( &eh->pipeEvent, eh->fds[0], EV_READ|EV_PERSIST, readFromPipe, NULL );