Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit aa0ccea

Browse filesBrowse files
author
James Nowell
committed
Added NullHandlers to all loggers to preven "No handler" messages
When the code is run without setting up loggers, the loggers have no handlers for the emitted messages. The logging module displays: `No handlers could be found for logger "git.cmd"` on the console. By adding a NullHandler (a no-op) the message disappears, and doesn't affect logging when other handlers are configured.
1 parent 640d150 commit aa0ccea
Copy full SHA for aa0ccea

File tree

5 files changed

+5
-0
lines changed
Filter options

5 files changed

+5
-0
lines changed

‎git/cmd.py

Copy file name to clipboardExpand all lines: git/cmd.py
+1Lines changed: 1 addition & 0 deletions
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

Copy file name to clipboardExpand all lines: git/config.py
+1Lines changed: 1 addition & 0 deletions
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

Copy file name to clipboardExpand all lines: git/objects/commit.py
+1Lines changed: 1 addition & 0 deletions
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

Copy file name to clipboardExpand all lines: git/objects/submodule/base.py
+1Lines changed: 1 addition & 0 deletions
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

Copy file name to clipboardExpand all lines: git/objects/submodule/root.py
+1Lines changed: 1 addition & 0 deletions
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):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.