- Timestamp:
- Aug 20, 2006, 6:15:25 PM (16 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/transmission.h
r788 r798 62 62 63 63 /*********************************************************************** 64 * tr_setErrorFunction 65 *********************************************************************** 66 * Sets the function used to display libtransmission errors. A NULL 67 * function means to use the default, which simple prints the message 68 * to stderr. The function's prototype should look like this: 69 * void myErrFunc( const char * errstr ); 70 **********************************************************************/ 71 void tr_setErrorFunction( void (*func)( const char * ) ); 64 * tr_setMessageFunction 65 *********************************************************************** 66 * Sets the function used to display libtransmission messages. This 67 * function must be reentrant, it may be called from different threads. 68 * A NULL argument means to print messages to stderr. The function's 69 * prototype should look like this: void myErrFunc( const char * ); 70 **********************************************************************/ 71 void tr_setMessageFunction( void (*func)( const char * ) ); 72 73 /*********************************************************************** 74 * tr_setMessageLevel 75 *********************************************************************** 76 * Set the level of messages to be output 77 **********************************************************************/ 78 #define TR_MSG_ERR 1 79 #define TR_MSG_INF 2 80 #define TR_MSG_DBG 4 81 void tr_setMessageLevel( int ); 82 int tr_getMessageLevel( void ); 72 83 73 84 /*********************************************************************** … … 82 93 * tr_setBindPort 83 94 *********************************************************************** 84 * Sets a "start" port: everytime we start a torrent, we try to bind 85 * this port, then the next one and so on until we are successful. 95 * Sets the port to listen for incoming peer connections 86 96 **********************************************************************/ 87 97 void tr_setBindPort( tr_handle_t *, int ); -
trunk/libtransmission/utils.c
r626 r798 25 25 #include "transmission.h" 26 26 27 static void (* errorFunc)( const char * );27 static void (*messageFunc)( const char * ); 28 28 29 void tr_setErrorFunction( void (*func)( const char * ) ) 29 static int verboseLevel = 0; 30 31 void tr_setMessageFunction( void (*func)( const char * ) ) 30 32 { 31 errorFunc = func; 33 messageFunc = func; 34 } 35 36 void tr_setMessageLevel( int level ) 37 { 38 verboseLevel = level; 39 } 40 41 int tr_getMessageLevel( void ) 42 { 43 return verboseLevel; 32 44 } 33 45 … … 36 48 char string[256]; 37 49 va_list args; 38 static int verboseLevel = 0;39 50 40 51 if( !verboseLevel ) … … 59 70 va_end( args ); 60 71 61 if( NULL == errorFunc )72 if( NULL == messageFunc ) 62 73 { 63 74 fprintf( stderr, "%s\n", string ); … … 65 76 else 66 77 { 67 errorFunc( string );78 messageFunc( string ); 68 79 } 69 80 } -
trunk/libtransmission/utils.h
r310 r798 26 26 #define TR_UTILS_H 1 27 27 28 #define TR_MSG_ERR 129 #define TR_MSG_INF 230 #define TR_MSG_DBG 431 28 #define tr_err( a... ) tr_msg( TR_MSG_ERR, ## a ) 32 29 #define tr_inf( a... ) tr_msg( TR_MSG_INF, ## a )
Note: See TracChangeset
for help on using the changeset viewer.