-
Notifications
You must be signed in to change notification settings - Fork 881
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
Opt-out of darts logging based on environment variable #1010
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1010 +/- ##
==========================================
+ Coverage 92.92% 93.03% +0.11%
==========================================
Files 76 77 +1
Lines 7628 7857 +229
==========================================
+ Hits 7088 7310 +222
- Misses 540 547 +7
Continue to review full report at Codecov.
|
Addresses #927 SummaryAfter some helpful suggestions from the community, we have now decided that the best solution is to stop adding custom handlers or formatters to our loggers.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
@brunnedu Just following along both threads, how do you want us to use the new wrapper to ignore the warnings of non-installed packages? Stick to only keeping logging level to warnings? # import and set logging level
import logging
logging.basicConfig(level=logging.WARNING)
# only then import darts
import darts ? |
@martinb-bb Unfortunately using import logging
# set level to ERROR, not logging levels WARNING and below anymore
logging.basicConfig(level=logging.ERROR)
import darts
from darts.models import RegressionModel Another option that works in either case would be to use: import contextlib
import os
with open(os.devnull,'w') as handle:
with contextlib.redirect_stderr(handle):
import darts
from darts.models import RegressionModel This could be especially useful if you don't want to modify |
OUTDATED, SEE BELOW FOR UPDATE
Addresses #927
Summary
DISABLE_DARTS_LOGGING
DISABLE_DARTS_LOGGING
is set to the string"1"
, theStreamHandler
is replaced with theNullHandler
in thedarts.logging.get_logger()
function.Other Information
I'm open to any suggestions on how we could handle this better.