Skip to content

Move down logging levels in mpl/__init__ to DEBUG. #10281

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

Merged
merged 1 commit into from
Jan 29, 2018
Merged
Changes from all commits
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
10 changes: 5 additions & 5 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def ge(self, level):
return self.vald[self.level] >= self.vald[level]


def _wrap(fmt, func, level='INFO', always=True):
def _wrap(fmt, func, level='DEBUG', always=True):
"""
return a callable function that wraps func and reports its
output through logger
Expand Down Expand Up @@ -1131,7 +1131,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
Please do not ask for support with these customizations active.
*****************************************************************
""", '\n'.join(config['text.latex.preamble']))
_log.info('loaded rc file %s', fname)
_log.debug('loaded rc file %s', fname)

return config

Expand Down Expand Up @@ -1839,7 +1839,7 @@ def inner(ax, *args, **kwargs):

return param

_log.info('matplotlib version %s', __version__)
_log.info('interactive is %s', is_interactive())
_log.info('platform is %s', sys.platform)
_log.debug('matplotlib version %s', __version__)
Copy link
Member

Choose a reason for hiding this comment

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

Don’t agree w these three. If we ask a user to debug their code af the info level we will want this info won’t we?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then just ask the user to report the DEBUG level log?...

In my view:
INFO = stuff that may be of general interest to a slightly technically savvy end user, if anything appears to be wrong.
DEBUG = stuff that we want to see in bug reports because we have no idea how the reporter's system is set up.

Copy link
Member

Choose a reason for hiding this comment

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

I think we should hash that out.

I was thinking DEBUG was for when the module writer wanted to get more information during debugging, or for future folks who need to debug the code. i.e. instead of havig to use a line debugger or print statements. If its really just so we can get more information about the user's set up, and actual debugging code is meant to just be added temporarily, we should delineate that in the development guide.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(As above, my main use case personally is that I just always have a logger on at INFO, and for most modules it's nice to have that around, and I can live with a little extra noise, but having it on literally every mpl import is a bit too noisy. Yes, I could also change my setup but meh.)

Copy link
Member

Choose a reason for hiding this comment

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

yeah, I usually instantiate the logger after the initial import, unless there is a good reason to see the import stuff...

Copy link
Contributor Author

@anntzer anntzer Jan 22, 2018

Choose a reason for hiding this comment

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

I have it set from the very beginning via an environment variable (https://coloredlogs.readthedocs.io/en/latest/#environment-variables), which avoids having to repeat the same boilerplate code in each and every script you write.

Copy link
Member

Choose a reason for hiding this comment

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

OK, fine. I don't want your terminal to run out of space....

_log.debug('interactive is %s', is_interactive())
_log.debug('platform is %s', sys.platform)
_log.debug('loaded modules: %s', list(sys.modules))