Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Simple logging interface. #13275

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
Feb 18, 2019
Merged

Simple logging interface. #13275

merged 1 commit into from
Feb 18, 2019

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jan 24, 2019

PR Summary

Small variant over #13129.
Handles the bug reported in #13264 (comment) as well.

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzer anntzer added this to the v3.1 milestone Jan 24, 2019
@NelleV
Copy link
Member

NelleV commented Jan 25, 2019

Thanks for the patch.

Next time, I think it would be worth trying to contribute and collaborate to the other author's pull request before taking over. Github makes this super easy by either creating pull requests on someone's branch, or making suggestions. It would allow to give appropriate credit to everyone who worked on the feature and helps contributors feel valued. If collaborating on the original pull request is not possible for technical reasons, discussing and asking the original author prior to redoing the work would be nice.

@anntzer
Copy link
Contributor Author

anntzer commented Jan 25, 2019

I would certainly not do this for a new contributor PR (except for long-dead PRs), and would be happy to credit @jklymak for the patch if he desires so (this is a general rule -- I'm not trying to game up my PR count (I could just split my mega-PRs into a bunch of smaller ones if I wanted to, to go back to a recent discussion...)).
In this specific case, though, you may notice that the implementation is nearly entirely different, so contributing it to the original thread would basically mean posting the whole patch, which hardly helps.

@jklymak
Copy link
Member

jklymak commented Jan 25, 2019

The point isn’t PR credit. It’s that I did spend some finite time on the original PR but hadn’t handled the reimplementation yet because so far as I could tell the discussion wasn’t over. It’s not a big deal, but we kind of do this for fun and having someone kick over your sandcastle and redo it for you is a bit off putting.

@anntzer
Copy link
Contributor Author

anntzer commented Jan 25, 2019

My apologies for any hurt feelings.

@timhoffm
Copy link
Member

I really appreciate that these social aspects can be addressed and criticisms is well received. When working remotely together, misunderstandings can easily happen and it’s hard to recognize and judge the emotions of others. @NelleV @anntzer @jklymak Well worked out 👍🏻

@timhoffm
Copy link
Member

Concerning the content of the PR: I‘m still convinced that we shouldn‘t add handlers ourselves. By now, I wouldn’t even introduce any convenience helper functions. Using logging.basicConfig() is simple enough. Documenting this should be sufficient.

However I acknowledge the idea behind the PR. And if a majority here decides that this philosophy is the way to go, I won’t object. But I’m not the one approving or merging this.

more verbose than `logger.WARNING` in their code with the Matplotlib-provided
helper::

matplotlib.set_loglevel("debug")
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 this should be plt.set_loglevel. Most folks import pyplot, they don't always import matplotlib....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@tacaswell
Copy link
Member

I want a bit longer to think about this.

(Standard functions from the `logging` module are also applicable; e.g. one
could call ``logging.basicConfig(level="DEBUG")`` even before importing
Matplotlib, or attach a custom handler to the "matplotlib" logger. This may
be useful if you use a custom logging configuration.)
Copy link
Member

Choose a reason for hiding this comment

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

This needs a note as well that sometimes logging before the first import is necessary in order to get the startup information. i.e.

If debug information is needed during the initial Matplotlib imports, the logging module should be configured before the first Matplotlib import by adding "import logging; logging.basicConfig(level="DEBUG")" to the top of your script.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added that to the parenthetical note.

Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

Aside from the doc change. plt.set_loglevel won't help with initial import problems.

@anntzer anntzer force-pushed the set_loglevel branch 2 times, most recently from 54ccc5f to 22edc4a Compare February 2, 2019 21:11
@jklymak jklymak added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Feb 11, 2019
@anntzer
Copy link
Contributor Author

anntzer commented Feb 11, 2019

rebased

@tacaswell tacaswell merged commit 6013532 into matplotlib:master Feb 18, 2019
@anntzer anntzer deleted the set_loglevel branch February 18, 2019 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants