From e19ecccae8901425064ed3a0d127b07204fc3557 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 19 Aug 2007 03:54:27 +0000 Subject: [PATCH] send libevent's warning messages to our logging framework instead of to the console --- libtransmission/trevent.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libtransmission/trevent.c b/libtransmission/trevent.c index 2253a49fb..122d63544 100644 --- a/libtransmission/trevent.c +++ b/libtransmission/trevent.c @@ -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 );