[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r2339: Rename the log namespace so we don't clash with log(double) (in vidalia/trunk: . src/torcontrol)



Author: edmanm
Date: 2008-02-06 00:32:54 -0500 (Wed, 06 Feb 2008)
New Revision: 2339

Modified:
   vidalia/trunk/
   vidalia/trunk/src/torcontrol/addressmap.cpp
   vidalia/trunk/src/torcontrol/controlconnection.cpp
   vidalia/trunk/src/torcontrol/controlsocket.cpp
   vidalia/trunk/src/torcontrol/debug.h
   vidalia/trunk/src/torcontrol/torprocess.cpp
Log:
 r107@lysithea:  edmanm | 2008-02-06 00:32:48 -0500
 Rename the log namespace so we don't clash with log(double) on panther.



Property changes on: vidalia/trunk
___________________________________________________________________
 svk:merge ticket from /local/vidalia/trunk [r107] on 90112fd6-a33b-4cea-8d39-48ff1d78625c

Modified: vidalia/trunk/src/torcontrol/addressmap.cpp
===================================================================
--- vidalia/trunk/src/torcontrol/addressmap.cpp	2008-02-05 02:22:05 UTC (rev 2338)
+++ vidalia/trunk/src/torcontrol/addressmap.cpp	2008-02-06 05:32:54 UTC (rev 2339)
@@ -38,7 +38,7 @@
 void
 AddressMap::add(QString from, QString to, QDateTime expires)
 {
-  log::debug("New address mapping: %1 -> %2 (expires %3)").arg(from)
+  tc::debug("New address mapping: %1 -> %2 (expires %3)").arg(from)
                                                           .arg(to)
                           .arg(expires.isValid() ? expires.toString(DATE_FMT)
                                                  : "never");

Modified: vidalia/trunk/src/torcontrol/controlconnection.cpp
===================================================================
--- vidalia/trunk/src/torcontrol/controlconnection.cpp	2008-02-05 02:22:05 UTC (rev 2338)
+++ vidalia/trunk/src/torcontrol/controlconnection.cpp	2008-02-06 05:32:54 UTC (rev 2339)
@@ -60,7 +60,7 @@
 ControlConnection::connect(QHostAddress addr, quint16 port)
 {
   if (isRunning()) {
-    log::error("Bug: Tried to call ControlConnection::connect() when the "
+    tc::error("Bug: Tried to call ControlConnection::connect() when the "
               "control thread is already running.");
     return;
   }
@@ -83,7 +83,7 @@
 ControlConnection::connect()
 {
   _connectAttempt++;
-  log::debug("Connecting to Tor (Attempt %1 of %2)").arg(_connectAttempt)
+  tc::debug("Connecting to Tor (Attempt %1 of %2)").arg(_connectAttempt)
                                                    .arg(MAX_CONNECT_ATTEMPTS);
   
   _connMutex.lock();
@@ -130,13 +130,13 @@
      * running, but it doesn't have a ControlPort open yet. */
     if (error == QAbstractSocket::ConnectionRefusedError &&
         _connectAttempt < MAX_CONNECT_ATTEMPTS) {
-      log::debug("Control connection refused. Retrying in %1ms.")
+      tc::debug("Control connection refused. Retrying in %1ms.")
                                        .arg(CONNECT_RETRY_DELAY);
       _connectTimer->start(CONNECT_RETRY_DELAY);
     } else {
       /* Exceeded maximum number of connect attempts. Give up. */
       QString errstr = ControlSocket::toString(error);
-      log::error("Vidalia was unable to connect to Tor: %1").arg(errstr);
+      tc::error("Vidalia was unable to connect to Tor: %1").arg(errstr);
       emit connectFailed(tr("Vidalia was unable to connect to Tor. (%1)")
                                                              .arg(errstr));
       setStatus(Disconnected);
@@ -144,12 +144,12 @@
   } else if (error == QAbstractSocket::RemoteHostClosedError) {
     /* Tor closed the connection. This is common when we send a 'shutdown' or
      * 'halt' signal to Tor and doesn't need to be logged as loudly. */
-    log::warn("Tor closed the control connection.");
+    tc::warn("Tor closed the control connection.");
   } else {
     /* Some other error. */
     /*XXX We may want to be emitting these so the GUI thread can learn about
      * them and display an error message. */
-    log::error("Control socket error: %1").arg(ControlSocket::toString(error));
+    tc::error("Control socket error: %1").arg(ControlSocket::toString(error));
   }
 }
 
@@ -157,7 +157,7 @@
 void
 ControlConnection::cancelConnect()
 {
-  log::warn("Control connection attempt cancelled.");
+  tc::warn("Control connection attempt cancelled.");
   setStatus(Disconnected);
   exit(0);
 }
@@ -199,7 +199,7 @@
 ControlConnection::setStatus(Status status)
 {
   QMutexLocker locker(&_statusMutex);
-  log::debug("Control connection status changed from '%1' to '%2'")
+  tc::debug("Control connection status changed from '%1' to '%2'")
                                        .arg(statusString(_status))
                                        .arg(statusString(status));
   _status = status;
@@ -222,10 +222,10 @@
     /* Wait for and get the result, clean up, and return */
     result = w->getResult(&reply, &errstr);
     if (!result)
-      log::error("Failed to receive control reply: %1").arg(errstr);
+      tc::error("Failed to receive control reply: %1").arg(errstr);
     delete w;
   } else {
-    log::error("Failed to send control command (%1): %2").arg(cmd.keyword())
+    tc::error("Failed to send control command (%1): %2").arg(cmd.keyword())
                                                         .arg(errstr);
     _recvMutex.unlock();
   }
@@ -247,7 +247,7 @@
   /* Check for a valid and connected socket */
   _connMutex.lock();
   if (!_sock || _status != Connected) {
-    log::warn("Unable to send control command '%1' when socket status is '%2'")
+    tc::warn("Unable to send control command '%1' when socket status is '%2'")
                                               .arg(cmd.keyword()).arg(_status);
     _connMutex.unlock();
     return err(errmsg, tr("Control socket is not connected."));
@@ -285,14 +285,14 @@
     if (_sock->readReply(reply, &errmsg)) {
       if (reply.getStatus() == "650") {
         /* Asynchronous event message */
-        log::debug("Control Event: %1").arg(reply.toString());
+        tc::debug("Control Event: %1").arg(reply.toString());
         
         if (_events) {
           _events->handleEvent(reply);
         }
       } else {
         /* Response to a previous command */
-        log::debug("Control Reply: %1").arg(reply.toString());
+        tc::debug("Control Reply: %1").arg(reply.toString());
         
         _recvMutex.lock();
         if (!_recvQueue.isEmpty()) {
@@ -302,7 +302,7 @@
         _recvMutex.unlock();
       }
     } else {
-      log::error("Unable to read control reply: %1").arg(errmsg);
+      tc::error("Unable to read control reply: %1").arg(errmsg);
     }
   }
 }
@@ -369,9 +369,9 @@
   
   /* Attempt to connect to Tor */
   connect();
-  log::debug("Starting control connection event loop.");
+  tc::debug("Starting control connection event loop.");
   exec();
-  log::debug("Exited control connection event loop.");
+  tc::debug("Exited control connection event loop.");
 
   /* Clean up the socket */
   _connMutex.lock();

Modified: vidalia/trunk/src/torcontrol/controlsocket.cpp
===================================================================
--- vidalia/trunk/src/torcontrol/controlsocket.cpp	2008-02-05 02:22:05 UTC (rev 2338)
+++ vidalia/trunk/src/torcontrol/controlsocket.cpp	2008-02-06 05:32:54 UTC (rev 2339)
@@ -64,7 +64,7 @@
   
   /* Format the control command */
   QString strCmd = cmd.toString();
-  log::debug("Control Command: %1").arg(strCmd.trimmed());
+  tc::debug("Control Command: %1").arg(strCmd.trimmed());
 
   /* Attempt to send the command to Tor */
   if (write(strCmd.toAscii()) != strCmd.length()) {

Modified: vidalia/trunk/src/torcontrol/debug.h
===================================================================
--- vidalia/trunk/src/torcontrol/debug.h	2008-02-05 02:22:05 UTC (rev 2338)
+++ vidalia/trunk/src/torcontrol/debug.h	2008-02-06 05:32:54 UTC (rev 2339)
@@ -33,7 +33,7 @@
 #include <QtDebug>
 
 
-namespace log {
+namespace tc {
 
 class Message {
   struct Stream {

Modified: vidalia/trunk/src/torcontrol/torprocess.cpp
===================================================================
--- vidalia/trunk/src/torcontrol/torprocess.cpp	2008-02-05 02:22:05 UTC (rev 2338)
+++ vidalia/trunk/src/torcontrol/torprocess.cpp	2008-02-06 05:32:54 UTC (rev 2339)
@@ -87,7 +87,7 @@
 #endif
   setEnvironment(env);
 
-  log::debug("Starting Tor using '%1 %2'").arg(app).arg(formatArguments(args));
+  tc::debug("Starting Tor using '%1 %2'").arg(app).arg(formatArguments(args));
   QProcess::start(exe, args, QIODevice::ReadOnly | QIODevice::Text);
 }
 
@@ -101,7 +101,7 @@
     return true;
   }
 
-  log::debug("Stopping the Tor process.");
+  tc::debug("Stopping the Tor process.");
   /* Tell the process to stop */
 #if defined(Q_OS_WIN32)
   /* Tor on Windows doesn't understand a WM_CLOSE message (which is what 
@@ -112,7 +112,7 @@
 
   /* Wait for it to complete */
   if (!waitForFinished(5000)) {
-    log::error("Tor failed to stop: %1").arg(errorString());
+    tc::error("Tor failed to stop: %1").arg(errorString());
     if (errmsg) {
       *errmsg = 
         tr("Process %1 failed to stop. [%2]").arg(pid()).arg(errorString());
@@ -181,11 +181,11 @@
 TorProcess::onError(QProcess::ProcessError error)
 {
   if (error == QProcess::FailedToStart) {
-    log::error("The Tor process failed to start: %1").arg(errorString());
+    tc::error("The Tor process failed to start: %1").arg(errorString());
     /* Tor didn't start, so let everyone know why. */
     emit startFailed(errorString());
   } else {
-    log::error("Tor process error: %1").arg(errorString());
+    tc::error("Tor process error: %1").arg(errorString());
   }
 }