Content-Length: 277370 | pFad | https://github.com/gitpython-developers/GitPython/commit/d1a9a232fbde88a347935804721ec7cd08de6f65

54 fix(logging): monkeypatch logging with NullHandler · gitpython-developers/GitPython@d1a9a23 · GitHub
Skip to content

Commit d1a9a23

Browse files
committed
fix(logging): monkeypatch logging with NullHandler
This will make usage of the `NullHandler` possible in python 2.6 and below.
1 parent aa0ccea commit d1a9a23

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

git/util.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import platform
1414
import getpass
1515
import threading
16+
import logging
1617

1718
# NOTE: Some of the unused imports might be used/imported by others.
1819
# Handle once test-cases are back up and running.
@@ -753,3 +754,12 @@ def wait(self):
753754
while self.count > 0:
754755
self.cv.wait()
755756
self.cv.release()
757+
758+
759+
class NullHandler(logging.Handler):
760+
def emit(self, record):
761+
pass
762+
763+
# In Python 2.6, there is no NullHandler yet. Let's monkey-patch it for a workaround.
764+
if not hasattr(logging, 'NullHandler'):
765+
logging.NullHandler = NullHandler

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/gitpython-developers/GitPython/commit/d1a9a232fbde88a347935804721ec7cd08de6f65

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy