-
Notifications
You must be signed in to change notification settings - Fork 25
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
Only call logging.basicConfig() when used as a command #468
Conversation
Codecov Report
@@ Coverage Diff @@
## master #468 +/- ##
==========================================
- Coverage 82.22% 82.15% -0.08%
==========================================
Files 55 55
Lines 5750 5749 -1
==========================================
- Hits 4728 4723 -5
- Misses 1022 1026 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
but what will happen if used as a Python module - every script would need to setup logging for our logger and thus we would loose ability to quickly enable logging via |
@yarikoptic |
that is what I thought but I wonder if that is generally a good strategy for a Python module? I did see double logging when datalad is used as a module and I wonder if that was a reason and should generally be avoided |
@yarikoptic The official Python logging tutorial has this to say about logging in a library:
|
Thank you @jwodder! One immediate aspect/"application" is logging during testing -- should log handler setup be added into a fixture? |
may be should be ok to enable it only if |
@yarikoptic pytest already captures logs, and there's already a fixture for setting the log level during tests. |
ah ok -- let's proceed then |
Closes #466.