diff options
author | Richard Hidalgo <rich@argonauta.org> | 2016-07-08 15:31:17 +0200 |
---|---|---|
committer | Richard Hidalgo <rich@argonauta.org> | 2016-07-08 15:31:17 +0200 |
commit | 0aabf856135bf0ba059b17816f8113f8672f7f7e (patch) | |
tree | 7adadb9a4e03ff0d7275244da59e93645c0d2093 | |
parent | 2e385528f8ea5c6b8b6ea2672c80a4778008479a (diff) | |
download | Git-Auto-Deploy-0aabf856135bf0ba059b17816f8113f8672f7f7e.zip Git-Auto-Deploy-0aabf856135bf0ba059b17816f8113f8672f7f7e.tar.gz Git-Auto-Deploy-0aabf856135bf0ba059b17816f8113f8672f7f7e.tar.bz2 |
allows gitautodeploy to start with --quiet and/or --daemon-mode using python 2.6 and solves https://github.com/olipo186/Git-Auto-Deploy/issues/118
-rw-r--r-- | gitautodeploy/gitautodeploy.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gitautodeploy/gitautodeploy.py b/gitautodeploy/gitautodeploy.py index c553362..21f1f16 100644 --- a/gitautodeploy/gitautodeploy.py +++ b/gitautodeploy/gitautodeploy.py @@ -246,6 +246,17 @@ class GitAutoDeploy(object): from lock import Lock from httpserver import WebhookRequestHandler + # This solves https://github.com/olipo186/Git-Auto-Deploy/issues/118 + try: + from logging import NullHandler + except ImportError: + from logging import Handler + + class NullHandler(Handler): + def emit(self, record): + pass + + # Attatch config values to this instance self._config = config @@ -255,7 +266,7 @@ class GitAutoDeploy(object): # Enable console output? if ('quiet' in self._config and self._config['quiet']) or ('daemon-mode' in self._config and self._config['daemon-mode']): - logger.addHandler(logging.NullHandler()) + logger.addHandler(NullHandler()) else: consoleHandler = logging.StreamHandler() consoleHandler.setFormatter(logFormatter) |