Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Logging to root logger is a bad practice - in order to allow customisation, a uniquely named logger should be used.
Normally, logs are sent to a logger named the same way as the module (i.e. entsoe, entsoe.decorators), or equivalently the logger name is set to
__name__
. The latter is what this PR introduces.See here and here.
This topic is hard to test automatically, so manual tests were performed.
Here's a reproducible setup:
main.py
:mymod/funs.py
:mymod/__init__.py
:After this PR the result of
main.py
is:which is very much expected - normal logs are intact and entsoe-py logs are logged only when explicitly required to do so.
Conversely, before this PR the result of
main.py
is:which is a mess. entsoe-py logs are hard to parse and normal logs are distorted since the first entsoe log.
I realize that the
propagate=False
trick was proposed in #86 but this is a half-measure. I also checked whether this approach still produces expected results.main2.py
:gives same result for old and new approach, hence this is not a breaking change (as far as the recommended approach goes).
Fixes: #86