1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 01:27:28 +00:00

(trunk libT) #1828: timestamp for log/debug output

This commit is contained in:
Charles Kerr 2009-02-18 05:09:28 +00:00
parent dfa9f075a4
commit fce040eb84

View file

@ -332,12 +332,17 @@ tr_msg( const char * file,
} }
else else
{ {
char timestr[64];
if( fp == NULL ) if( fp == NULL )
fp = stderr; fp = stderr;
tr_getLogTimeStr( timestr, sizeof( timestr ) );
if( name ) if( name )
fprintf( fp, "%s: %s\n", name, buf ); fprintf( fp, "[%s] %s: %s\n", timestr, name, buf );
else else
fprintf( fp, "%s\n", buf ); fprintf( fp, "[%s] %s\n", timestr, buf );
fflush( fp ); fflush( fp );
} }
} }
@ -1403,7 +1408,7 @@ parseNumberSection( const char * str, int len, struct number_range * setme )
char * tmp = tr_strndup( str, len ); char * tmp = tr_strndup( str, len );
errno = 0; errno = 0;
a = strtol( tmp, &end, 10 ); a = b = strtol( tmp, &end, 10 );
if( errno || ( end == tmp ) ) { if( errno || ( end == tmp ) ) {
success = FALSE; success = FALSE;
} else if( *end != '-' ) { } else if( *end != '-' ) {