Permalink
Browse files

dag: Silence the default logger

git-dag does not register a handler for Interaction.log()
so it ends up printing the 'inotify' message to stdout.
Silence it.

Signed-off-by: David Aguilar <davvid@gmail.com>
  • Loading branch information...
davvid committed Dec 21, 2012
1 parent 262180d commit 91e01f402fc51b03b657ccda71f11a4e789404a2
Showing with 9 additions and 4 deletions.
  1. +9 −4 cola/interaction.py
View
@@ -1,9 +1,13 @@
+import os
import subprocess
from cola import utils
class Interaction(object):
"""Prompts the user and answers questions"""
+
+ VERBOSE = bool(os.getenv('GIT_COLA_VERBOSE'))
+
@staticmethod
def information(title,
message=None, details=None, informative_text=None):
@@ -46,7 +50,7 @@ def question(cls, title, message, default=True):
@classmethod
def run_command(cls, title, cmd):
- print('$ ' + subprocess.list2cmdline(cmd))
+ cls.log('$ ' + subprocess.list2cmdline(cmd))
status, out, err = utils.run_command(cmd)
cls.log_status(status, out, err)
@@ -64,6 +68,7 @@ def log_status(cls, status, out, err=None):
status))
cls.log(msg)
- @staticmethod
- def log(message):
- print(message)
+ @classmethod
+ def log(cls, message):
+ if cls.VERBOSE:
+ print(message)

0 comments on commit 91e01f4

Please sign in to comment.