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

[tor-commits] [ooni-probe/master] Improve readablity of output by removing some log messages.



commit c0a1e7fe37d6e7d59ac18f568435e6287d110551
Author: Arturo Filastò <art@xxxxxxxxx>
Date:   Thu Jun 19 15:40:00 2014 +0200

    Improve readablity of output by removing some log messages.
---
 ooni/director.py |    2 +-
 ooni/errors.py   |   42 ++++++++++++++++++++----------------------
 ooni/managers.py |    4 ++--
 3 files changed, 23 insertions(+), 25 deletions(-)

diff --git a/ooni/director.py b/ooni/director.py
index 1414184..901088f 100644
--- a/ooni/director.py
+++ b/ooni/director.py
@@ -194,7 +194,7 @@ class Director(object):
         return measurement
 
     def measurementFailed(self, failure, measurement):
-        log.msg("Failed doing measurement: %s" % measurement)
+        log.debug("Failed doing measurement: %s" % measurement)
         self.totalMeasurementRuntime += measurement.runtime
 
         self.failedMeasurements += 1
diff --git a/ooni/errors.py b/ooni/errors.py
index fe6350b..d5673ed 100644
--- a/ooni/errors.py
+++ b/ooni/errors.py
@@ -64,87 +64,85 @@ def failureToString(failure):
 
         A string representing the HTTP response error message.
     """
-    from ooni.utils import log
-
     string = None
     if isinstance(failure.value, ConnectionRefusedError):
-        log.err("Connection refused.")
+        # log.err("Connection refused.")
         string = 'connection_refused_error'
 
     elif isinstance(failure.value, ConnectionLost):
-        log.err("Connection lost.")
+        # log.err("Connection lost.")
         string = 'connection_lost_error'
 
     elif isinstance(failure.value, ConnectError):
-        log.err("Connect error.")
+        # log.err("Connect error.")
         string = 'connect_error'
 
     elif isinstance(failure.value, gaierror):
-        log.err("Address family for hostname not supported")
+        # log.err("Address family for hostname not supported")
         string = 'address_family_not_supported_error'
 
     elif isinstance(failure.value, DNSLookupError):
-        log.err("DNS lookup failure")
+        # log.err("DNS lookup failure")
         string = 'dns_lookup_error'
 
     elif isinstance(failure.value, TCPTimedOutError):
-        log.err("TCP Timed Out Error")
+        # log.err("TCP Timed Out Error")
         string = 'tcp_timed_out_error'
 
     elif isinstance(failure.value, ResponseNeverReceived):
-        log.err("Response Never Received")
+        # log.err("Response Never Received")
         string = 'response_never_received'
 
     elif isinstance(failure.value, DeferTimeoutError):
-        log.err("Deferred Timeout Error")
+        # log.err("Deferred Timeout Error")
         string = 'deferred_timeout_error'
 
     elif isinstance(failure.value, GenericTimeoutError):
-        log.err("Time Out Error")
+        # log.err("Time Out Error")
         string = 'generic_timeout_error'
 
     elif isinstance(failure.value, ServerFailure):
-        log.err("SOCKS error: ServerFailure")
+        # log.err("SOCKS error: ServerFailure")
         string = 'socks_server_failure'
 
     elif isinstance(failure.value, ConnectionNotAllowed):
-        log.err("SOCKS error: ConnectionNotAllowed")
+        # log.err("SOCKS error: ConnectionNotAllowed")
         string = 'socks_connection_not_allowed'
 
     elif isinstance(failure.value, NetworkUnreachable):
-        log.err("SOCKS error: NetworkUnreachable")
+        # log.err("SOCKS error: NetworkUnreachable")
         string = 'socks_network_unreachable'
 
     elif isinstance(failure.value, HostUnreachable):
-        log.err("SOCKS error: HostUnreachable")
+        # log.err("SOCKS error: HostUnreachable")
         string = 'socks_host_unreachable'
 
     elif isinstance(failure.value, ConnectionRefused):
-        log.err("SOCKS error: ConnectionRefused")
+        # log.err("SOCKS error: ConnectionRefused")
         string = 'socks_connection_refused'
 
     elif isinstance(failure.value, TTLExpired):
-        log.err("SOCKS error: TTLExpired")
+        # log.err("SOCKS error: TTLExpired")
         string = 'socks_ttl_expired'
 
     elif isinstance(failure.value, CommandNotSupported):
-        log.err("SOCKS error: CommandNotSupported")
+        # log.err("SOCKS error: CommandNotSupported")
         string = 'socks_command_not_supported'
 
     elif isinstance(failure.value, AddressNotSupported):
-        log.err("SOCKS error: AddressNotSupported")
+        # log.err("SOCKS error: AddressNotSupported")
         string = 'socks_address_not_supported'
 
     elif isinstance(failure.value, SOCKSError):
-        log.err("Generic SOCKS error")
+        # log.err("Generic SOCKS error")
         string = 'socks_error'
 
     elif isinstance(failure.value, CancelledError):
-        log.err("Task timed out")
+        # log.err("Task timed out")
         string = 'task_timed_out'
 
     else:
-        log.err("Unknown failure type: %s" % type(failure.value))
+        # log.err("Unknown failure type: %s" % type(failure.value))
         string = 'unknown_failure %s' % str(failure.value)
 
     return string
diff --git a/ooni/managers.py b/ooni/managers.py
index ca1cd5b..d03d2c9 100644
--- a/ooni/managers.py
+++ b/ooni/managers.py
@@ -29,7 +29,7 @@ class TaskManager(object):
         The has failed to complete, we append it to the end of the task chain
         to be re-run once all the currently scheduled tasks have run.
         """
-        log.err("Task %s has failed %s times" % (task, task.failures))
+        log.debug("Task %s has failed %s times" % (task, task.failures))
         if config.advanced.debug:
             log.exception(failure)
 
@@ -42,7 +42,7 @@ class TaskManager(object):
 
         else:
             # This fires the errback when the task is done but has failed.
-            log.err('Permanent failure for %s' % task)
+            log.debug('Permanent failure for %s' % task)
             task.done.errback(failure)
 
         self._fillSlots()



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits