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

[tor-commits] [bridgedb/master] Don't create new loggers in modules loaded into bridgedb.Main.



commit d0cfeacd66cc744f44134dc13f87b323de0f4b41
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Tue Nov 5 07:57:45 2013 +0000

    Don't create new loggers in modules loaded into bridgedb.Main.
    
    If these create their own loggers, and/or are imported as absolute imports
    specifying the full package name, then the new loggers get created before the
    root logger is configured.
    
     * REMOVE logger creation in bridgedb.parse.headers and bridgedb.crypto.
---
 lib/bridgedb/Main.py          |    2 +-
 lib/bridgedb/crypto.py        |    5 ++---
 lib/bridgedb/parse/headers.py |    1 -
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/bridgedb/Main.py b/lib/bridgedb/Main.py
index f87c1df..384547e 100644
--- a/lib/bridgedb/Main.py
+++ b/lib/bridgedb/Main.py
@@ -16,9 +16,9 @@ import gettext
 
 from twisted.internet import reactor
 
+from bridgedb import crypto
 from bridgedb.parse import options
 
-import bridgedb.crypto
 import bridgedb.Bridges as Bridges
 import bridgedb.Dist as Dist
 import bridgedb.Time as Time
diff --git a/lib/bridgedb/crypto.py b/lib/bridgedb/crypto.py
index 124d337..70e9ee1 100644
--- a/lib/bridgedb/crypto.py
+++ b/lib/bridgedb/crypto.py
@@ -13,7 +13,6 @@ from __future__ import absolute_import
 from __future__ import unicode_literals
 
 import logging
-log = logging.getLogger(__name__)
 
 import os
 
@@ -45,7 +44,7 @@ def getKey(filename):
     try:
         fh = open(filename, 'rb')
     except IOError:
-        log.debug("getKey(): Creating new secret key.")
+        logging.debug("getKey(): Creating new secret key.")
         key = OpenSSL.rand.bytes(32)
         flags = os.O_WRONLY | os.O_TRUNC | os.O_CREAT | getattr(os, "O_BIN", 0)
         fd = os.open(filename, flags, 0400)
@@ -53,7 +52,7 @@ def getKey(filename):
         os.fsync(fd)
         fd.close()
     else:
-        log.debug("getKey(): Secret key file found. Loading...")
+        logging.debug("getKey(): Secret key file found. Loading...")
         key = fh.read()
         fh.close()
     return key
diff --git a/lib/bridgedb/parse/headers.py b/lib/bridgedb/parse/headers.py
index d9f1c4b..6b9d371 100644
--- a/lib/bridgedb/parse/headers.py
+++ b/lib/bridgedb/parse/headers.py
@@ -20,7 +20,6 @@
 """
 
 import logging
-log = logging.getLogger()
 
 import re
 import os



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