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

[tor-commits] [bridgedb/master] Add utility module with safe logging functions and new SAFELOGGING config option



commit 131e0f9b43002ab22e779c886d3a0953390ddded
Author: Matthew Finkel <Matthew.Finkel@xxxxxxxxx>
Date:   Tue Jul 9 01:33:13 2013 +0000

    Add utility module with safe logging functions and new SAFELOGGING config option
---
 bridgedb.conf        |    3 +++
 lib/bridgedb/Util.py |   12 ++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/bridgedb.conf b/bridgedb.conf
index 2b97d78..b565b37 100644
--- a/bridgedb.conf
+++ b/bridgedb.conf
@@ -12,6 +12,9 @@ PIDFILE = "bridgedb.pid"
 # Either a file to log to, or None if we should log to the console.
 LOGFILE = "bridgedb.log"
 
+# If true, we scrub all potentially identifying information before we log it
+SAFELOGGING = True
+
 # Logfile rotation settings
 LOGFILE_COUNT = 5
 LOGFILE_ROTATE_SIZE = 10000000
diff --git a/lib/bridgedb/Util.py b/lib/bridgedb/Util.py
new file mode 100644
index 0000000..e0ce81f
--- /dev/null
+++ b/lib/bridgedb/Util.py
@@ -0,0 +1,12 @@
+safe_logging = True
+
+def set_safe_logging(safe):
+    global safe_logging
+    safe_logging = safe
+
+def logSafely(val):
+    if safe_logging:
+        return "[scrubbed]"
+    else:
+        return val
+



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