Adamw has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/120810

Change subject: Configuration to control stdout quietness
......................................................................

Configuration to control stdout quietness

Change-Id: Id4efa3884aeab85c3c4c728708dae167f6644b1b
---
M process/globals.py
M process/logging.py
2 files changed, 13 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools 
refs/changes/10/120810/1

diff --git a/process/globals.py b/process/globals.py
index a89f0a0..319bb03 100644
--- a/process/globals.py
+++ b/process/globals.py
@@ -31,6 +31,11 @@
 
     raise Exception("No config found, searched " + ", ".join(search_filenames))
 
+def get_config():
+    """Procedural way to get the config, to workaround early bootstrapping 
fluctuations"""
+    global config
+    return config
+
 class DictAsAttrDict(dict):
     def __getattr__(self, name):
         value = self[name]
diff --git a/process/logging.py b/process/logging.py
index 4fd7e0c..6d56e0f 100644
--- a/process/logging.py
+++ b/process/logging.py
@@ -32,7 +32,11 @@
         syslog.syslog(severity, message)
         syslog.closelog()
 
-        # FIXME:
-        # if sys.stdout.isatty():
-        # or not config.quiet
-        print(message)
+        # Echo to stdout?
+        config = get_config()
+        if sys.stdout.isatty() or (not hasattr(config, 'quiet') or not 
config.quiet):
+            print(message)
+
+
+# Late import to deal with circular dependency
+from process.globals import get_config

-- 
To view, visit https://gerrit.wikimedia.org/r/120810
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id4efa3884aeab85c3c4c728708dae167f6644b1b
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/tools
Gerrit-Branch: master
Gerrit-Owner: Adamw <awi...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to