Changeset 2304

Show
Ignore:
Timestamp:
01/18/08 16:15:45 (12 months ago)
Author:
edmanm
Message:

r42@lysithea: edmanm | 2008-01-18 16:15:28 -0500
Reenable all the logging in src/torcontrol that I had to disable during the
re-org when we moved to CMake.

Location:
vidalia/trunk/src/torcontrol
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • vidalia/trunk/src/torcontrol/addressmap.cpp

    r2184 r2304  
    2727 
    2828#include <QStringList> 
    29 //#include <vidalia.h> 
    30  
     29#include "debug.h" 
    3130#include "addressmap.h" 
    3231 
     
    4039AddressMap::add(QString from, QString to, QDateTime expires) 
    4140{ 
    42 #if 0 
    43   vInfo("New address mapping: %1 -> %2 (expires %3)") 
    44     .arg(from).arg(to) 
    45     .arg(expires.isValid() ? expires.toString(DATE_FMT) : "never"); 
    46 #endif 
     41  log::debug("New address mapping: %1 -> %2 (expires %3)").arg(from) 
     42                                                          .arg(to) 
     43                          .arg(expires.isValid() ? expires.toString(DATE_FMT) 
     44                                                 : "never"); 
    4745  insert(from, addr_map_entry_t(to, expires)); 
    4846} 
  • vidalia/trunk/src/torcontrol/controlcommand.cpp

    r2263 r2304  
    2525 * \brief A command sent to Tor's control interface 
    2626 */ 
    27  
    2827 
    2928#include "controlcommand.h" 
  • vidalia/trunk/src/torcontrol/controlconnection.cpp

    r2184 r2304  
    3030#include <QMutexLocker> 
    3131#include <stringutil.h> 
     32#include "debug.h" 
    3233 
    3334#include "controlconnection.h" 
     
    6061{ 
    6162  if (isRunning()) { 
    62 #if 0 
    63     vError("Bug: Tried to call ControlConnection::connect() when the " 
    64           "control thread is already running."); 
    65 #endif 
     63    log::error("Bug: Tried to call ControlConnection::connect() when the " 
     64              "control thread is already running."); 
    6665    return; 
    6766  } 
     
    8584{ 
    8685  _connectAttempt++; 
    87 #if 0 
    88   vInfo("Connecting to Tor (Attempt %1 of %2)").arg(_connectAttempt) 
    89                                                .arg(MAX_CONNECT_ATTEMPTS); 
    90 #endif 
     86  log::debug("Connecting to Tor (Attempt %1 of %2)").arg(_connectAttempt) 
     87                                                   .arg(MAX_CONNECT_ATTEMPTS); 
     88   
    9189  _connMutex.lock(); 
    9290  _sock->connectToHost(_addr, _port); 
     
    133131    if (error == QAbstractSocket::ConnectionRefusedError && 
    134132        _connectAttempt < MAX_CONNECT_ATTEMPTS) { 
    135 #if 0 
    136       vInfo("Control connection refused. Retrying in %1ms.") 
    137                                                   .arg(CONNECT_RETRY_DELAY); 
    138 #endif 
     133      log::debug("Control connection refused. Retrying in %1ms.") 
     134                                       .arg(CONNECT_RETRY_DELAY); 
    139135      _connectTimer->start(CONNECT_RETRY_DELAY); 
    140136    } else { 
    141137      /* Exceeded maximum number of connect attempts. Give up. */ 
    142138      QString errstr = ControlSocket::toString(error); 
    143 //      vWarn("Vidalia was unable to connect to Tor: %1").arg(errstr); 
     139      log::error("Vidalia was unable to connect to Tor: %1").arg(errstr); 
    144140      emit connectFailed(tr("Vidalia was unable to connect to Tor. (%1)") 
    145141                                                             .arg(errstr)); 
     
    149145    /* Tor closed the connection. This is common when we send a 'shutdown' or 
    150146     * 'halt' signal to Tor and doesn't need to be logged as loudly. */ 
    151 //    vNotice("Tor closed the control connection."); 
     147    log::warn("Tor closed the control connection."); 
    152148  } else { 
    153149    /* Some other error. */ 
    154150    /*XXX We may want to be emitting these so the GUI thread can learn about 
    155151     * them and display an error message. */ 
    156 //    vWarn("Control socket error: %1").arg(ControlSocket::toString(error)); 
     152    log::error("Control socket error: %1").arg(ControlSocket::toString(error)); 
    157153  } 
    158154} 
     
    162158ControlConnection::cancelConnect() 
    163159{ 
    164 //  vNotice("Control connection attempt cancelled."); 
     160  log::warn("Control connection attempt cancelled."); 
    165161  setStatus(Disconnected); 
    166162  exit(0); 
     
    204200{ 
    205201  QMutexLocker locker(&_statusMutex); 
    206 #if 0 
    207   vNotice("Control connection status changed from '%1' to '%2'") 
    208                                     .arg(statusString(_status)) 
    209                                     .arg(statusString(status)); 
    210 #endif 
     202  log::debug("Control connection status changed from '%1' to '%2'") 
     203                                       .arg(statusString(_status)) 
     204                                       .arg(statusString(status)); 
    211205  _status = status; 
    212206} 
     
    228222    /* Wait for and get the result, clean up, and return */ 
    229223    result = w->getResult(&reply, &errstr); 
    230 //    if (!result) 
    231 //      vWarn("Failed to receive control reply: %1").arg(errstr); 
     224    if (!result) 
     225      log::error("Failed to receive control reply: %1").arg(errstr); 
    232226    delete w; 
    233227  } else { 
    234 //    vWarn("Failed to send control command (%1): %2") 
    235 //      .arg(cmd.keyword()).arg(errstr); 
     228    log::error("Failed to send control command (%1): %2").arg(cmd.keyword()) 
     229                                                        .arg(errstr); 
    236230    _recvMutex.unlock(); 
    237231  } 
     
    254248  _connMutex.lock(); 
    255249  if (!_sock || _status != Connected) { 
    256 //    vDebug("Unable to send control command '%1' when socket status is '%2'") 
    257 //                                            .arg(cmd.keyword()).arg(_status); 
     250    log::warn("Unable to send control command '%1' when socket status is '%2'") 
     251                                              .arg(cmd.keyword()).arg(_status); 
    258252    _connMutex.unlock(); 
    259253    return err(errmsg, tr("Control socket is not connected.")); 
     
    292286      if (reply.getStatus() == "650") { 
    293287        /* Asynchronous event message */ 
    294 //        vDebug("Control Event: %1").arg(reply.toString()); 
     288        log::debug("Control Event: %1").arg(reply.toString()); 
    295289         
    296290        if (_events) { 
     
    299293      } else { 
    300294        /* Response to a previous command */ 
    301 //        vInfo("Control Reply: %1").arg(reply.toString()); 
     295        log::debug("Control Reply: %1").arg(reply.toString()); 
    302296         
    303297        _recvMutex.lock(); 
     
    309303      } 
    310304    } else { 
    311 //      vWarn("Unable to read control reply: %1").arg(errmsg); 
     305      log::error("Unable to read control reply: %1").arg(errmsg); 
    312306    } 
    313307  } 
     
    376370  /* Attempt to connect to Tor */ 
    377371  connect(); 
    378 //  vDebug("Starting control connection event loop."); 
     372  log::debug("Starting control connection event loop."); 
    379373  exec(); 
    380 //  vDebug("Exited control connection event loop."); 
     374  log::debug("Exited control connection event loop."); 
    381375 
    382376  /* Clean up the socket */ 
  • vidalia/trunk/src/torcontrol/controlsocket.cpp

    r2184 r2304  
    2727 
    2828#include <stringutil.h> 
    29 //#include <vidalia.h> 
     29#include "debug.h" 
    3030 
    3131#include "controlsocket.h" 
     
    6565  /* Format the control command */ 
    6666  QString strCmd = cmd.toString(); 
    67 //  vInfo("Control Command: %1").arg(strCmd.trimmed()); 
     67  log::debug("Control Command: %1").arg(strCmd.trimmed()); 
    6868 
    6969  /* Attempt to send the command to Tor */ 
  • vidalia/trunk/src/torcontrol/torevents.cpp

    r2184 r2304  
    2828#include <QApplication> 
    2929#include <stringutil.h> 
    30 //#include <vidalia.h> 
    3130 
    3231#include "circuit.h" 
  • vidalia/trunk/src/torcontrol/torprocess.cpp

    r2208 r2304  
    2727 
    2828#include <QString> 
    29 //#include <vidalia.h> 
    3029#include <stringutil.h> 
     30#include "debug.h" 
    3131 
    3232/* Needed for _PROCESS_INFORMATION so that pid() works on Win32 */ 
     
    8888  setEnvironment(env); 
    8989 
    90 //  vNotice("Starting Tor using '%1 %2'").arg(app).arg(formatArguments(args)); 
     90  log::debug("Starting Tor using '%1 %2'").arg(app).arg(formatArguments(args)); 
    9191  QProcess::start(exe, args, QIODevice::ReadOnly | QIODevice::Text); 
    9292} 
     
    102102  } 
    103103 
    104 //  vNotice("Stopping the Tor process."); 
     104  log::debug("Stopping the Tor process."); 
    105105  /* Tell the process to stop */ 
    106106#if defined(Q_OS_WIN32) 
     
    113113  /* Wait for it to complete */ 
    114114  if (!waitForFinished(5000)) { 
    115 //    vWarn("Tor failed to stop: %1").arg(errorString()); 
     115    log::error("Tor failed to stop: %1").arg(errorString()); 
    116116    if (errmsg) { 
    117117      *errmsg =  
     
    182182{ 
    183183  if (error == QProcess::FailedToStart) { 
    184 //    vWarn("The Tor process failed to start: %1").arg(errorString()); 
     184    log::error("The Tor process failed to start: %1").arg(errorString()); 
    185185    /* Tor didn't start, so let everyone know why. */ 
    186186    emit startFailed(errorString()); 
    187187  } else { 
    188 //    vWarn("Tor process error: %1").arg(errorString()); 
     188    log::error("Tor process error: %1").arg(errorString()); 
    189189  } 
    190190} 
  • vidalia/trunk/src/torcontrol/torservice.cpp

    r2190 r2304  
    2828#include <QLibrary> 
    2929 
     30#include "debug.h" 
    3031#include "torservice.h" 
    3132 
     
    150151 
    151152  if (!service) { 
    152 //    vWarn("Bug: We tried to start the Tor service, but it is not installed."); 
     153    log::error("Bug: We tried to start the Tor service, but it is not installed."); 
    153154    emit startFailed(tr("The Tor service is not installed.")); 
    154155    return; 
     
    158159  if (status() != SERVICE_RUNNING) { 
    159160    int tries = 0; 
    160 //    vNotice("Starting the Tor service."); 
     161    log::debug("Starting the Tor service."); 
    161162    _service_fns.StartServiceA(service, 0, NULL); 
    162163 
     
    168169    emit started(); 
    169170  } else { 
    170 //    vWarn("Unable to start the Tor service."); 
     171    log::error("Unable to start the Tor service."); 
    171172    emit startFailed(tr("Unable to start the Tor service.")); 
    172173  } 
     
    186187    SERVICE_STATUS stat; 
    187188    stat.dwCurrentState = SERVICE_RUNNING; 
    188 //    vNotice("Stopping the Tor service."); 
     189    log::debug("Stopping the Tor service."); 
    189190    if (_service_fns.ControlService(service, SERVICE_CONTROL_STOP, &stat)) { 
    190191      /* XXX Five seconds isn't long enough to wait when we're stopping a Tor 
     
    205206  } 
    206207  /* XXX This needs an actual reason message. */ 
    207 //  vWarn("Unable to stop the Tor service."); 
     208  log::error("Unable to stop the Tor service."); 
    208209  return false; 
    209210} 
     
    262263                                                 .arg(controlPort); 
    263264 
    264 //    vNotice("Installing the Tor service using the command line '%1'") 
    265 //                                                        .arg(command); 
     265    log::debug("Installing the Tor service using the command line '%1'") 
     266                                                          .arg(command); 
    266267    service = _service_fns.CreateServiceA(_scm,  
    267268                              (LPCTSTR)TOR_SERVICE_NAME, (LPCTSTR)TOR_SERVICE_DISP, 
     
    272273    if (!service) { 
    273274      /* XXX This needs an actual reason message. */ 
    274 //      vWarn("Failed to install the Tor service."); 
     275      log::error("Failed to install the Tor service."); 
    275276      return false; 
    276277    } 
     
    295296  if (service) { 
    296297    stop(); 
    297 //    vNotice("Removing the Tor service."); 
     298    log::debug("Removing the Tor service."); 
    298299    removed = _service_fns.DeleteService(service); 
    299300    closeHandle(service); 
     
    301302  if (!removed) { 
    302303    /* XXX This needs an actual reason message. */ 
    303 //    vWarn("Failed to remove the Tor service."); 
     304    log::error("Failed to remove the Tor service."); 
    304305  } 
    305306  return removed;