Changeset 5243


Ignore:
Timestamp:
Mar 13, 2008, 3:53:18 AM (14 years ago)
Author:
charles
Message:

#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages#138: per-torrent messages

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/msgwin.c

    r5227 r5243  
    111111    }
    112112
    113     line = g_strdup_printf( "%02i:%02i:%02i %s\n", tm->tm_hour, tm->tm_min, tm->tm_sec, ii->message );
     113    line = ( ii->name != NULL )
     114        ? g_strdup_printf( "%02i:%02i:%02i [%s] %s\n", tm->tm_hour, tm->tm_min, tm->tm_sec, ii->name, ii->message )
     115        : g_strdup_printf( "%02i:%02i:%02i %s\n", tm->tm_hour, tm->tm_min, tm->tm_sec, ii->message );
    114116    len = strlen( line );
    115117
  • trunk/libtransmission/fastresume.c

    r5224 r5243  
    189189    file = fopen( path, "wb+" );
    190190    if( !file ) {
    191         tr_err( _( "Couldn't open \"%s\": %s" ), path, tr_strerror( errno ) );
     191        tr_torerr( tor, _( "Couldn't open \"%s\": %s" ), path, tr_strerror( errno ) );
    192192        return;
    193193    }
     
    324324
    325325    fclose( file );
    326 
    327     /*tr_dbg( "Wrote resume file for \"%s\"", tor->info.name );*/
    328326}
    329327
     
    420418            else {
    421419                tr_torrentSetFileChecked( tor, i, FALSE );
    422                 tr_dbg( _( "Torrent \"%s\" needs to be verified" ), tor->info.files[i].name );
     420                tr_tordbg( tor, _( "Torrent needs to be verified" ) );
    423421            }
    424422        }
     
    543541        }
    544542
    545         tr_dbg( _( "Loaded %i peers from resume file" ), count );
     543        tr_tordbg( tor, _( "Loaded %i peers from resume file" ), count );
    546544        ret = TR_FR_PEERS;
    547545    }
     
    589587            case FR_ID_MAX_PEERS:    ret |= parseConnections( tor, buf, len ); break;
    590588            case FR_ID_DESTINATION:  ret |= parseDestination( tor, buf, len ); break;
    591             default:                 tr_dbg( _( "Skipping unknown resume code %d" ), (int)id ); break;
     589            default:                 tr_tordbg( tor, _( "Skipping unknown resume code %d" ), (int)id ); break;
    592590        }
    593591
     
    633631    if( !buf )
    634632        /* %s is the torrent name */
    635         tr_inf( _( "Couldn't read resume file for \"%s\"" ), tor->info.name );
     633        tr_torinf( tor, _( "Couldn't read resume file for \"%s\"" ), tor->info.name );
    636634    else {
    637635        const uint8_t * walk = buf;
     
    644642            else
    645643                /* %s is the torrent name */
    646                 tr_inf( _( "Skipping invalid resume file for \"%s\"" ), tor->info.name );
     644                tr_torinf( tor, _( "Skipping invalid resume file for \"%s\"" ), tor->info.name );
    647645        }
    648646
  • trunk/libtransmission/natpmp.c

    r5224 r5243  
    6666{
    6767    if( ret==NATPMP_TRYAGAIN )
    68         tr_dbg( _( "%s: %s responded 'try again'" ), getKey(), func );
     68        tr_ndbg( getKey(), _( "%s responded 'try again'" ), func );
    6969    else if( ret >= 0 )
    70         tr_dbg( _( "%s: %s succeeded (%d)" ), getKey(), func, ret );
     70        tr_ndbg( getKey(), _( "%s succeeded (%d)" ), func, ret );
    7171    else
    72         tr_err( _( "%s: %s failed (%d): %s (%d)" ), getKey(), func, ret, tr_strerror(errno), errno );
     72        tr_nerr( getKey(), _( "%s failed (%d): %s (%d)" ), func, ret, tr_strerror(errno), errno );
    7373}
    7474
     
    110110setErrorState( struct tr_natpmp * nat )
    111111{
    112     tr_err( _( "%s: If your router supports NAT-PMP, please make sure NAT-PMP is enabled!" ), getKey() );
    113     tr_err( _( "%s: NAT-PMP port forwarding unsuccessful, trying UPnP next" ), getKey() );
     112    tr_nerr( getKey(), _( "If your router supports NAT-PMP, please make sure NAT-PMP is enabled!" ) );
     113    tr_nerr( getKey(), _( "NAT-PMP port forwarding unsuccessful, trying UPnP next" ) );
    114114    nat->state = TR_NATPMP_ERR;
    115115}
     
    137137        logVal( "readnatpmpresponseorretry", val );
    138138        if( val >= 0 ) {
    139             tr_inf( _( "%s: found public address %s" ), getKey(), inet_ntoa( response.publicaddress.addr ) );
     139            tr_ninf( getKey(), _( "found public address %s" ), inet_ntoa( response.publicaddress.addr ) );
    140140            nat->state = TR_NATPMP_IDLE;
    141141        } else if( val != NATPMP_TRYAGAIN ) {
     
    164164        logVal( "readnatpmpresponseorretry", val );
    165165        if( val >= 0 ) {
    166             tr_inf( _( "%s: no longer forwarding port %d" ), getKey(), nat->port );
     166            tr_ninf( getKey(), _( "no longer forwarding port %d" ), nat->port );
    167167            nat->state = TR_NATPMP_IDLE;
    168168            nat->port = -1;
     
    200200            nat->renewTime = time( NULL ) + LIFETIME_SECS;
    201201            nat->port = resp.newportmapping.privateport;
    202             tr_inf( _( "%s: port %d forwarded successfully" ), getKey(), nat->port );
     202            tr_ninf( getKey(), _( "port %d forwarded successfully" ), nat->port );
    203203        } else if( val != NATPMP_TRYAGAIN ) {
    204204            setErrorState( nat );
  • trunk/libtransmission/peer-msgs.c

    r5225 r5243  
    973973    {
    974974        const int n = sub->val.s.i / 6 ;
    975         tr_inf( _( "Torrent \"%s\" got %d peers from peer exchange" ), msgs->torrent->info.name, n );
     975        tr_torinf( msgs->torrent, _( "Got %d peers from peer exchange" ), n );
    976976        tr_peerMgrAddPeers( msgs->handle->peerMgr,
    977977                            msgs->torrent->info.hash,
  • trunk/libtransmission/shared.c

    r5226 r5243  
    9494        status = tr_upnpPulse( s->upnp, port, isEnabled );
    9595    if( status != s->natStatus ) {
    96         tr_inf( _( "%s: state changed from \"%s\" to \"%s\"" ), getKey(), getNatStateStr(s->natStatus), getNatStateStr(status) );
     96        tr_ninf( getKey(), _( "state changed from \"%s\" to \"%s\"" ), getNatStateStr(s->natStatus), getNatStateStr(status) );
    9797        s->natStatus = status;
    9898    }
     
    104104    if( s->bindSocket >= 0 && ( s->bindPort != s->publicPort ) )
    105105    {
    106         tr_inf( _( "%s: Closing port %d" ), getKey(), s->bindPort );
     106        tr_ninf( getKey(), _( "Closing port %d" ), s->bindPort );
    107107        tr_netClose( s->bindSocket );
    108108        s->bindSocket = -1;
     
    115115        socket = tr_netBindTCP( s->publicPort );
    116116        if( socket >= 0 ) {
    117             tr_inf( _( "%s: Opened port %d to listen for incoming peer connections" ), getKey(), s->publicPort );
     117            tr_ninf( getKey(), _( "Opened port %d to listen for incoming peer connections" ), s->publicPort );
    118118            s->bindPort = s->publicPort;
    119119            s->bindSocket = socket;
    120120            listen( s->bindSocket, 5 );
    121121        } else {
    122             tr_err( _( "%s: Couldn't open port %d to listen for incoming peer connections (errno %d - %s)" ),
    123                     getKey(), s->publicPort, errno, tr_strerror(errno) );
     122            tr_nerr( getKey(), _( "Couldn't open port %d to listen for incoming peer connections (errno %d - %s)" ),
     123                    s->publicPort, errno, tr_strerror(errno) );
    124124            s->bindPort = -1;
    125125            s->bindSocket = -1;
     
    158158    else if( ( shared->natStatus == TR_NAT_TRAVERSAL_ERROR ) || ( shared->natStatus == TR_NAT_TRAVERSAL_UNMAPPED ) )
    159159    {
    160         tr_dbg( _( "%s: stopped" ), getKey() );
     160        tr_ndbg( getKey(), _( "Stopped" ) );
    161161        shared->h->shared = NULL;
    162162        tr_netClose( shared->bindSocket );
  • trunk/libtransmission/torrent.c

    r5241 r5243  
    158158
    159159        case TR_TRACKER_WARNING:
    160             tr_err( _( "Tracker warning: %s" ), event->text );
     160            tr_torerr( tor, _( "Tracker warning: %s" ), event->text );
    161161            tor->error = TR_ERROR_TC_WARNING;
    162162            strlcpy( tor->errorString, event->text, sizeof(tor->errorString) );
     
    164164
    165165        case TR_TRACKER_ERROR:
    166             tr_err( _( "Tracker error: %s" ), event->text );
     166            tr_torerr( tor, _( "Tracker error: %s" ), event->text );
    167167            tor->error = TR_ERROR_TC_ERROR;
    168168            strlcpy( tor->errorString, event->text, sizeof(tor->errorString) );
     
    876876    h->torrentCount--;
    877877
    878     tr_inf( _( "Closing torrent %s; %d torrents left" ),
    879             tor->info.name, h->torrentCount );
     878    tr_torinf( tor, _( "Closing torrent %s; %d torrents left" ),
     879              h->torrentCount );
    880880
    881881    tr_metainfoFree( inf );
  • trunk/libtransmission/tracker.c

    r5173 r5243  
    263263    event.peerCount = count;
    264264    event.peerCompact = peers;
    265     tr_dbg( "Torrent \"%s\" got %d new peers", t->name, count );
     265    tr_ndbg( t->name, "Torrent got %d new peers", t->name, count );
    266266    if( count )
    267267        tr_publisherPublish( t->publisher, t, &event );
     
    413413        strlcpy( t->lastAnnounceResponse, req->response_code_line, sizeof( t->lastAnnounceResponse ) );
    414414
    415     tr_dbg( "Torrent \"%s\" tracker response: %s",
    416             t->name,
    417             ( req ? req->response_code_line : "(null)") );
     415    tr_ndbg( t->name, "tracker response: %s",
     416             ( req ? req->response_code_line : "(null)") );
    418417
    419418    if( req && ( req->response_code == HTTP_OK ) )
     
    574573        strlcpy( t->lastScrapeResponse, req->response_code_line, sizeof( t->lastScrapeResponse ) );
    575574
    576     tr_dbg( "Got scrape response for  '%s': %s",
    577             t->name,
    578             ( ( req && req->response_code_line ) ? req->response_code_line
    579                                                  : "(null)") );
     575    tr_ndbg( t->name, "Got scrape response: \"%s\"",
     576            ( ( req && req->response_code_line ) ? req->response_code_line : "(null)") );
    580577
    581578    if( req && ( req->response_code == HTTP_OK ) )
     
    613610                        t->scrapeIntervalSec = tmp->val.i;
    614611
    615                 tr_dbg( "Torrent '%s' scrape successful."
    616                         "  Rescraping in %d seconds",
    617                         t->name, t->scrapeIntervalSec );
     612                tr_ndbg( t->name, "Scrape successful.  Rescraping in %d seconds.",
     613                         t->scrapeIntervalSec );
    618614
    619615                nextScrapeSec = t->scrapeIntervalSec;
  • trunk/libtransmission/transmission.h

    r5185 r5243  
    160160typedef struct tr_msg_list
    161161{
    162     uint8_t              level;
    163     time_t               when;
    164     char               * message;
    165     const char         * file;
    166     int                  line;
     162    /* TR_MSG_ERR, TR_MSG_INF, or TR_MSG_DBG */
     163    uint8_t level;
     164
     165    /* Time the message was generated */
     166    time_t when;
     167
     168    /* The torrent associated with this message,
     169     * or a module name such as "Port Forwarding" for non-torrent messages,
     170     * or NULL. */
     171    char * name;
     172
     173    /* The message */
     174    char * message;
     175
     176    /* The source file where this message originated */
     177    const char * file;
     178
     179    /* The line number in the source file where this message originated */
     180    int line;
     181
     182    /* linked list of messages */
    167183    struct tr_msg_list * next;
    168184}
  • trunk/libtransmission/upnp.c

    r5226 r5243  
    8989        devlist = upnpDiscover( 2000, NULL, NULL );
    9090        if( devlist == NULL ) {
    91             tr_err( _( "%s: upnpDiscover failed (errno %d - %s)" ), getKey(), errno, tr_strerror(errno) );
     91            tr_nerr( getKey(), _( "upnpDiscover failed (errno %d - %s)" ), errno, tr_strerror(errno) );
    9292        }
    9393        errno = 0;
    9494        if( UPNP_GetValidIGD( devlist, &handle->urls, &handle->data, handle->lanaddr, sizeof(handle->lanaddr))) {
    95             tr_inf( _( "%s: Found Internet Gateway Device \"%s\"" ), getKey(), handle->urls.controlURL );
    96             tr_inf( _( "%s: Local Address is \"%s\"" ), getKey(), handle->lanaddr );
     95            tr_ninf( getKey(), _( "Found Internet Gateway Device \"%s\"" ), handle->urls.controlURL );
     96            tr_ninf( getKey(), _( "Local Address is \"%s\"" ), handle->lanaddr );
    9797            handle->state = TR_UPNP_IDLE;
    9898            handle->hasDiscovered = 1;
    9999        } else {
    100100            handle->state = TR_UPNP_ERR;
    101             tr_err( _( "%s: UPNP_GetValidIGD failed (errno %d - %s)" ), getKey(), errno, tr_strerror(errno) );
    102             tr_err( _( "%s: If your router supports UPnP, please make sure UPnP is enabled!" ), getKey() );
     101            tr_nerr( getKey(), _( "UPNP_GetValidIGD failed (errno %d - %s)" ), errno, tr_strerror(errno) );
     102            tr_nerr( getKey(), _( "If your router supports UPnP, please make sure UPnP is enabled!" ) );
    103103        }
    104104        freeUPNPDevlist( devlist );
     
    118118                                handle->data.servicetype,
    119119                                portStr, "TCP" );
    120         tr_dbg( _( "%s: Stopping port forwarding of \"%s\", service \"%s\"" ),
    121                 getKey(), handle->urls.controlURL, handle->data.servicetype );
     120        tr_ndbg( getKey(), _( "Stopping port forwarding of \"%s\", service \"%s\"" ),
     121                handle->urls.controlURL, handle->data.servicetype );
    122122        handle->isMapped = 0;
    123123        handle->state = TR_UPNP_IDLE;
     
    147147            handle->isMapped = !err;
    148148        }
    149         tr_inf( _( "%s: Port forwarding via \"%s\", service \"%s\".  (local address: %s:%d)" ),
    150                 getKey(), handle->urls.controlURL, handle->data.servicetype, handle->lanaddr, port );
     149        tr_ninf( getKey(), _( "Port forwarding via \"%s\", service \"%s\".  (local address: %s:%d)" ),
     150                handle->urls.controlURL, handle->data.servicetype, handle->lanaddr, port );
    151151        if( handle->isMapped ) {
    152             tr_inf( _( "%s: Port forwarding successful!" ), getKey() );
     152            tr_ninf( getKey(), _( "Port forwarding successful!" ) );
    153153            handle->port = port;
    154154            handle->state = TR_UPNP_IDLE;
    155155        } else {
    156             tr_err( _( "%s: Port forwarding failed with error %d (%d - %s)" ), getKey(), err, errno, tr_strerror(errno) );
    157             tr_err( _( "%s: If your router supports UPnP, please make sure UPnP is enabled!" ), getKey() );
     156            tr_nerr( getKey(), _( "Port forwarding failed with error %d (%d - %s)" ), err, errno, tr_strerror(errno) );
     157            tr_nerr( getKey(), _( "If your router supports UPnP, please make sure UPnP is enabled!" ) );
    158158            handle->port = -1;
    159159            handle->state = TR_UPNP_ERR;
  • trunk/libtransmission/utils.c

    r5226 r5243  
    117117}
    118118
    119 int tr_getMessageLevel( void )
     119int
     120tr_getMessageLevel( void )
    120121{
    121122    int ret;
     
    129130}
    130131
    131 void tr_setMessageQueuing( int enabled )
     132void
     133tr_setMessageQueuing( int enabled )
    132134{
    133135    tr_msgInit();
     
    137139}
    138140
    139 tr_msg_list * tr_getQueuedMessages( void )
     141tr_msg_list *
     142tr_getQueuedMessages( void )
    140143{
    141144    tr_msg_list * ret;
     
    151154}
    152155
    153 void tr_freeMessageList( tr_msg_list * list )
     156void
     157tr_freeMessageList( tr_msg_list * list )
    154158{
    155159    tr_msg_list * next;
     
    159163        next = list->next;
    160164        free( list->message );
     165        free( list->name );
    161166        free( list );
    162167        list = next;
     
    193198
    194199void
    195 tr_msg( const char * file, int line, int level, const char * fmt, ... )
     200tr_msg( const char * file, int line, int level,
     201        const char * name,
     202        const char * fmt, ... )
    196203{
    197204    FILE * fp;
     
    230237                newmsg->file = file;
    231238                newmsg->line = line;
     239                newmsg->name = tr_strdup( name );
    232240
    233241                *messageQueueTail = newmsg;
  • trunk/libtransmission/utils.h

    r5202 r5243  
    4444#endif
    4545
    46 #define tr_err( a... ) tr_msg( __FILE__, __LINE__, TR_MSG_ERR, ## a )
    47 #define tr_inf( a... ) tr_msg( __FILE__, __LINE__, TR_MSG_INF, ## a )
    48 #define tr_dbg( a... ) tr_msg( __FILE__, __LINE__, TR_MSG_DBG, ## a )
    49 void tr_msg  ( const char * file, int line, int level, const char * msg, ... );
     46#define tr_nerr( n, a... ) tr_msg( __FILE__, __LINE__, TR_MSG_ERR, n, ## a )
     47#define tr_ninf( n, a... ) tr_msg( __FILE__, __LINE__, TR_MSG_INF, n, ## a )
     48#define tr_ndbg( n, a... ) tr_msg( __FILE__, __LINE__, TR_MSG_DBG, n, ## a )
     49
     50#define tr_torerr( tor, a... ) tr_msg( __FILE__, __LINE__, TR_MSG_ERR, tor->info.name, ## a )
     51#define tr_torinf( tor, a... ) tr_msg( __FILE__, __LINE__, TR_MSG_INF, tor->info.name, ## a )
     52#define tr_tordbg( tor, a... ) tr_msg( __FILE__, __LINE__, TR_MSG_DBG, tor->info.name, ## a )
     53
     54#define tr_err( a... ) tr_msg( __FILE__, __LINE__, TR_MSG_ERR, NULL, ## a )
     55#define tr_inf( a... ) tr_msg( __FILE__, __LINE__, TR_MSG_INF, NULL, ## a )
     56#define tr_dbg( a... ) tr_msg( __FILE__, __LINE__, TR_MSG_DBG, NULL, ## a )
     57void tr_msg  ( const char * file, int line, int level, const char * torrent, const char * msg, ... );
    5058FILE* tr_getLog( void );
    5159
  • trunk/libtransmission/verify.c

    r5221 r5243  
    126126        tor->verifyState = TR_VERIFY_NOW;
    127127
    128         tr_inf( _( "Verifying torrent \"%s\"" ), tor->info.name );
     128        tr_torinf( tor, _( "Verifying torrent" ) );
    129129        for( i=0; i<tor->info.fileCount && !stopCurrent; ++i )
    130130            checkFile( tor, i, &stopCurrent );
     
    158158        struct verify_node * node;
    159159
    160         tr_inf( _( "Queueing \"%s\" for verification" ), tor->info.name );
     160        tr_torinf( tor, _( "Queued for verification" ) );
    161161
    162162        node = tr_new( struct verify_node, 1 );
Note: See TracChangeset for help on using the changeset viewer.