diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2015-06-26 09:17:19 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2015-06-26 09:17:19 +0200 |
commit | d1a9a232fbde88a347935804721ec7cd08de6f65 (patch) | |
tree | 59bd270c549bf4e516c613354658c028ce66c1a1 /git/util.py | |
parent | aa0ccead680443b07fd675f8b906758907bdb415 (diff) | |
download | gitpython-d1a9a232fbde88a347935804721ec7cd08de6f65.tar.gz |
fix(logging): monkeypatch logging with NullHandler
This will make usage of the `NullHandler` possible in python 2.6
and below.
Diffstat (limited to 'git/util.py')
-rw-r--r-- | git/util.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/git/util.py b/git/util.py index fb459da1..f0a08e79 100644 --- a/git/util.py +++ b/git/util.py @@ -13,6 +13,7 @@ import shutil import platform import getpass import threading +import logging # NOTE: Some of the unused imports might be used/imported by others. # Handle once test-cases are back up and running. @@ -753,3 +754,12 @@ class WaitGroup(object): while self.count > 0: self.cv.wait() self.cv.release() + + +class NullHandler(logging.Handler): + def emit(self, record): + pass + +# In Python 2.6, there is no NullHandler yet. Let's monkey-patch it for a workaround. +if not hasattr(logging, 'NullHandler'): + logging.NullHandler = NullHandler |