summaryrefslogtreecommitdiffstats
path: root/gitautodeploy/gitautodeploy.py
diff options
context:
space:
mode:
authorOliver Poignant <oliver@poignant.se>2016-05-18 21:13:02 +0200
committerOliver Poignant <oliver@poignant.se>2016-05-18 21:13:02 +0200
commitf3549261d30ae22fc86977a2a8661f965d95684f (patch)
tree48a31731f46d81c662fa23e78e6e8ff1fcfd9796 /gitautodeploy/gitautodeploy.py
parente512d7a63ddbe7ed7576b54d7dac087dc1b24e41 (diff)
downloadGit-Auto-Deploy-f3549261d30ae22fc86977a2a8661f965d95684f.zip
Git-Auto-Deploy-f3549261d30ae22fc86977a2a8661f965d95684f.tar.gz
Git-Auto-Deploy-f3549261d30ae22fc86977a2a8661f965d95684f.tar.bz2
Do not add multiple console handlers during tests
Diffstat (limited to 'gitautodeploy/gitautodeploy.py')
-rw-r--r--gitautodeploy/gitautodeploy.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/gitautodeploy/gitautodeploy.py b/gitautodeploy/gitautodeploy.py
index 342ce9e..f24ec6e 100644
--- a/gitautodeploy/gitautodeploy.py
+++ b/gitautodeploy/gitautodeploy.py
@@ -253,7 +253,16 @@ class GitAutoDeploy(object):
else:
consoleHandler = logging.StreamHandler()
consoleHandler.setFormatter(logFormatter)
- logger.addHandler(consoleHandler)
+
+ # Check if a stream handler is already present (will be if GAD is started by test script)
+ handler_present = False
+ for handler in logger.handlers:
+ if isinstance(handler, type(consoleHandler)):
+ handler_present = True
+ break
+
+ if not handler_present:
+ logger.addHandler(consoleHandler)
# Set logging level
if 'log-level' in self._config: