Skip to content

Log lines for debugging #572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
More Pythonic way to check for NullHandler
  • Loading branch information
expobrain committed Jan 10, 2017
commit 478334edb6e2f0170d7653a337c80172cc5bb8ae
4 changes: 3 additions & 1 deletion git/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
'HIDE_WINDOWS_KNOWN_ERRORS')


if not hasattr(logging, 'NullHandler'):
try: # Python 2.7+
import logging.NullHandler
except ImportError:
class NullHandler(logging.Handler):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what the NullHandler is used for. So far it was sufficient to obtain a logging using logging.getLogger('git.util') and assume parties interested in logging have set it up to contain/inherit handlers.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I juts following the same pattern of enable logging like it is done in other part of GitPython as well (see git/cmd.py for example). The only difference is that unit tests under Python 2.6+ are failing because the logging package in 2.6 doesn't have the NullHandler thus this little piece of code.

def emit(self, record):
pass
Expand Down