commit 9684dee4bde88e096fe85603c62dca35d8441468
Author: Arturo Filastò <art(a)fuffa.org>
Date: Thu Nov 22 18:52:44 2012 +0100
Move scapy set log level to the logger module so that it gets called before scapy is imported.
---
ooni/reporter.py | 10 +---------
ooni/utils/log.py | 4 ++++
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/ooni/reporter.py b/ooni/reporter.py
index 0635d2f..265cd93 100644
--- a/ooni/reporter.py
+++ b/ooni/reporter.py
@@ -26,15 +26,7 @@ from ooni.utils import otime, log, geodata
from ooni.utils.hacks import OSafeRepresenter, OSafeDumper
from ooni import config
-try:
- ## Get rid of the annoying "No route found for
- ## IPv6 destination warnings":
- logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
- from scapy.all import packet
-except:
- class FooClass:
- Packet = object
- packet = FooClass
+from scapy.all import packet
class NoTestIDSpecified(Exception):
pass
diff --git a/ooni/utils/log.py b/ooni/utils/log.py
index d9b57bb..170d7b5 100644
--- a/ooni/utils/log.py
+++ b/ooni/utils/log.py
@@ -15,6 +15,10 @@ from twisted.python.logfile import DailyLogFile
from ooni.utils import otime
from ooni import config
+## Get rid of the annoying "No route found for
+## IPv6 destination warnings":
+logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
+
def start(logfile=None, application_name="ooniprobe"):
daily_logfile = None