[Pkg-privacy-commits] [onionbalance] 65/117: Simplify logger output from the onionbalance-config command line tool

Donncha O'Cearbahill donncha-guest at moszumanska.debian.org
Wed Dec 16 23:18:47 UTC 2015


This is an automated email from the git hooks/post-receive script.

donncha-guest pushed a commit to branch debian/sid
in repository onionbalance.

commit ec34b4168e00bab8d23673e3e5783560766c5de8
Author: Donncha O'Cearbhaill <donncha at donncha.is>
Date:   Mon Jun 29 17:08:59 2015 +0100

    Simplify logger output from the onionbalance-config command line tool
---
 onionbalance/data/torrc-server |  2 +-
 onionbalance/log.py            | 14 ++++++++++++++
 onionbalance/settings.py       |  3 +++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/onionbalance/data/torrc-server b/onionbalance/data/torrc-server
index 4845528..d25edfc 100644
--- a/onionbalance/data/torrc-server
+++ b/onionbalance/data/torrc-server
@@ -1,4 +1,4 @@
-# Tor config for the managment server
+# Tor config for the management server
 # ---
 # The management server must be able to access the Tor control port.
 # Alternatively the control port can be enabled on the system Tor process.
diff --git a/onionbalance/log.py b/onionbalance/log.py
index be124db..f498eac 100644
--- a/onionbalance/log.py
+++ b/onionbalance/log.py
@@ -15,3 +15,17 @@ def get_logger():
     Returns a logger.
     """
     return logger
+
+
+def get_config_generator_logger():
+    """
+    Simplified logger for interactive config generator CLI
+    """
+    handler = logging.StreamHandler()
+    handler.setFormatter(logging.Formatter(fmt="[%(levelname)s]: "
+                                               "%(message)s"))
+
+    logger = logging.getLogger("onionbalance-config")
+    logger.addHandler(handler)
+    logger.setLevel(logging.INFO)
+    return logger
diff --git a/onionbalance/settings.py b/onionbalance/settings.py
index 0daf391..3755e5c 100644
--- a/onionbalance/settings.py
+++ b/onionbalance/settings.py
@@ -159,6 +159,9 @@ def generate_config():
     Entry point for interactive config file generation.
     """
 
+    # Simplify the logging output for the command line tool
+    logger = log.get_config_generator_logger()
+
     logger.info("Beginning OnionBalance config generation.")
 
     # Parse initial command line options

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onionbalance.git



More information about the Pkg-privacy-commits mailing list