Ignore:
Timestamp:
Apr 25, 2008, 2:57:33 AM (14 years ago)
Author:
charles
Message:

fold most of the "deep logging" functions into a single function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/handshake.c

    r5632 r5689  
    1717#include <string.h>
    1818#include <stdio.h>
    19 #include <libgen.h> /* basename */
    2019
    2120#include <event.h>
     
    135134**/
    136135
    137 static void
    138 myDebug( const char * file, int line, const tr_handshake * handshake, const char * fmt, ... )
    139 {
    140     FILE * fp = tr_getLog( );
    141     if( fp != NULL )
    142     {
    143         va_list args;
    144         char timestr[64];
    145         struct evbuffer * buf = evbuffer_new( );
    146         char * myfile = tr_strdup( file );
    147 
    148         evbuffer_add_printf( buf, "[%s] %s: ",
    149                              tr_getLogTimeStr( timestr, sizeof(timestr) ),
    150                              tr_peerIoGetAddrStr( handshake->io ) );
    151         va_start( args, fmt );
    152         evbuffer_add_vprintf( buf, fmt, args );
    153         va_end( args );
    154         evbuffer_add_printf( buf, " (%s:%d)\n", basename(myfile), line );
    155         fwrite( EVBUFFER_DATA(buf), 1, EVBUFFER_LENGTH(buf), fp );
    156 
    157         tr_free( myfile );
    158         evbuffer_free( buf );
    159     }
    160 }
    161 
    162 #define dbgmsg(handshake, fmt...) myDebug(__FILE__, __LINE__, handshake, ##fmt )
     136#define dbgmsg(handshake, fmt...) tr_deepLog( __FILE__, __LINE__, tr_peerIoGetAddrStr( handshake->io ), ##fmt )
    163137
    164138static const char* getStateName( short state )
Note: See TracChangeset for help on using the changeset viewer.