joblib now logs to joblib namespace and no longer adds a stream handler to the root logger.#1033
joblib now logs to joblib namespace and no longer adds a stream handler to the root logger.#1033amniskin wants to merge 3 commits intojoblib:masterfrom amniskin:master
Conversation
using logging.(debug,warning, etc) from within a library is unwise as it forces the end user to have a stream handler on the root logger. Now you'll be logging to the joblib namespace, so that users can specify a logging level via `logging.getLogger('joblib').setLevel(logging.DEBUG)` or whatever they want.
created a joblib logger.
Codecov Report
@@ Coverage Diff @@
## master #1033 +/- ##
==========================================
+ Coverage 94.89% 94.92% +0.03%
==========================================
Files 45 45
Lines 6803 6804 +1
==========================================
+ Hits 6456 6459 +3
+ Misses 347 345 -2
Continue to review full report at Codecov.
|
|
What's going on here? A bunch of things that seem to have nothing to do with anything I changed are now broken (things like pickling io objects). Was that me? |
|
Yes most probably: I'm actively (right now) working on a consistent and compliant usage of |
It adds about 10ns to each log use.
|
Thanks! I thought joblib was supposed to be able to pickle loggers. Hmm... |
|
So now there are no loggers stored in the object, and it adds minimal overhead (I timed it and it's like 10ns to get a logger). Would this be an acceptable (if temporary) fix? |
|
This way the user can attach whatever log handlers they want to the joblib logger. And if we wanted to get even crazier, we could have each subclass specify a child namespace to log to (e.g. joblib.memory, etc), and then users could attach log handlers to joblib, joblib.memory, or whatever they want. |
Indeed this would be much better -- I have been working on this last week and I'll open a PR once #1018 is merged. |
|
Oops, I wanted to close and reopen this PR to make the CI pass but I cannot reopen it because the repository has been deleted. Will duplicate it. |
produces the following output:
The culprit was that the
Loggerclass was using the barelogging.warningfunctions instead of instantiating a logger and then using that logger's logging functions as it should have. Furthermore, it should be logging to a joblib namespace.