From 1a673bd33f7dcd0d8fecd94a2086c01f88a2ecc9 Mon Sep 17 00:00:00 2001 From: Tomas Touceda Date: Tue, 9 Apr 2013 10:46:15 -0300 Subject: Revert "Remove logging setup from thandy" This reverts commit d2b0896dcef897437bf2ffdb69848fff8ff9c1c9. --- lib/thandy/ClientCLI.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/thandy/ClientCLI.py b/lib/thandy/ClientCLI.py index b86b5eb..d3bcaf0 100644 --- a/lib/thandy/ClientCLI.py +++ b/lib/thandy/ClientCLI.py @@ -39,6 +39,7 @@ class RegularLogFilter: def configureLogs(options): logLevel = logging.INFO + cLogFormat = False for o,v in options: if o == '--debug': logLevel = logging.DEBUG @@ -46,9 +47,21 @@ def configureLogs(options): logLevel = logging.INFO elif o == '--warn': logLevel = logging.WARN + elif o == '--controller-log-format': + cLogFormat = True + console = logging.StreamHandler() + console.setLevel(logLevel) logger = logging.getLogger("") + logger.addHandler(console) logger.setLevel(logLevel) + if cLogFormat: + #formatter = logging.Formatter("%(names)s %(levelname)s %(message)r") + formatter = ControlLogFormatter() + else: + formatter = logging.Formatter("%(levelname)s:%(message)s") + console.addFilter(RegularLogFilter()) + console.setFormatter(formatter) def update(args): repoRoot = thandy.util.userFilename("cache") -- cgit v1.2.3