Skip to content

Commit 8724dfa

Browse files
committedJun 26, 2015
Merge branch 'missionfocus-loggingNullHandlers'
2 parents 640d150 + d1a9a23 commit 8724dfa

File tree

6 files changed

+15
-0
lines changed

6 files changed

+15
-0
lines changed
 

‎git/cmd.py

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
'output_stream')
4545

4646
log = logging.getLogger('git.cmd')
47+
log.addHandler(logging.NullHandler())
4748

4849
__all__ = ('Git', )
4950

‎git/config.py

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333

3434
log = logging.getLogger('git.config')
35+
log.addHandler(logging.NullHandler())
3536

3637

3738
class MetaParserBuilder(abc.ABCMeta):

‎git/objects/commit.py

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import logging
3535

3636
log = logging.getLogger('git.objects.commit')
37+
log.addHandler(logging.NullHandler())
3738

3839
__all__ = ('Commit', )
3940

‎git/objects/submodule/base.py

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343

4444

4545
log = logging.getLogger('git.objects.submodule.base')
46+
log.addHandler(logging.NullHandler())
4647

4748

4849
class UpdateProgress(RemoteProgress):

‎git/objects/submodule/root.py

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
__all__ = ["RootModule", "RootUpdateProgress"]
1414

1515
log = logging.getLogger('git.objects.submodule.root')
16+
log.addHandler(logging.NullHandler())
1617

1718

1819
class RootUpdateProgress(UpdateProgress):

‎git/util.py

+10
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)
Please sign in to comment.