summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Nowell <jcnowell@missionfocus.com>2015-06-25 09:24:40 -0400
committerJames Nowell <jcnowell@missionfocus.com>2015-06-25 09:24:40 -0400
commitaa0ccead680443b07fd675f8b906758907bdb415 (patch)
treef60f653c3d9873cb42de7d7ef9307c1354f3da86
parent640d1506e7f259d675976e7fffcbc854d41d4246 (diff)
downloadgitpython-aa0ccead680443b07fd675f8b906758907bdb415.tar.gz
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.
-rw-r--r--git/cmd.py1
-rw-r--r--git/config.py1
-rw-r--r--git/objects/commit.py1
-rw-r--r--git/objects/submodule/base.py1
-rw-r--r--git/objects/submodule/root.py1
5 files changed, 5 insertions, 0 deletions
diff --git a/git/cmd.py b/git/cmd.py
index 87e482d8..c0eeec0a 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -44,6 +44,7 @@ execute_kwargs = ('istream', 'with_keep_cwd', 'with_extended_output',
'output_stream')
log = logging.getLogger('git.cmd')
+log.addHandler(logging.NullHandler())
__all__ = ('Git', )
diff --git a/git/config.py b/git/config.py
index a6a25c7b..2d9adbdd 100644
--- a/git/config.py
+++ b/git/config.py
@@ -32,6 +32,7 @@ __all__ = ('GitConfigParser', 'SectionConstraint')
log = logging.getLogger('git.config')
+log.addHandler(logging.NullHandler())
class MetaParserBuilder(abc.ABCMeta):
diff --git a/git/objects/commit.py b/git/objects/commit.py
index ac381cd9..d301e301 100644
--- a/git/objects/commit.py
+++ b/git/objects/commit.py
@@ -34,6 +34,7 @@ from io import BytesIO
import logging
log = logging.getLogger('git.objects.commit')
+log.addHandler(logging.NullHandler())
__all__ = ('Commit', )
diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py
index f9b0b6ad..30201e09 100644
--- a/git/objects/submodule/base.py
+++ b/git/objects/submodule/base.py
@@ -43,6 +43,7 @@ __all__ = ["Submodule", "UpdateProgress"]
log = logging.getLogger('git.objects.submodule.base')
+log.addHandler(logging.NullHandler())
class UpdateProgress(RemoteProgress):
diff --git a/git/objects/submodule/root.py b/git/objects/submodule/root.py
index 1c863f6f..4fe856c2 100644
--- a/git/objects/submodule/root.py
+++ b/git/objects/submodule/root.py
@@ -13,6 +13,7 @@ import logging
__all__ = ["RootModule", "RootUpdateProgress"]
log = logging.getLogger('git.objects.submodule.root')
+log.addHandler(logging.NullHandler())
class RootUpdateProgress(UpdateProgress):