Skip to content
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

Merged
merged 3 commits into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions darts/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,9 @@ def get_logger(name):
"""

logger = logging.getLogger(name)
# default logging level is logging.INFO
logger.setLevel(logging.INFO)
stderr_handler = logging.StreamHandler()
formatter = logging.Formatter(
"[%(asctime)s] %(levelname)s | %(name)s | %(message)s"
)
stderr_handler.setFormatter(formatter)
logger.addHandler(stderr_handler)

return logger


Expand Down
8 changes: 4 additions & 4 deletions darts/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
from darts.models.forecasting.auto_arima import AutoARIMA
from darts.models.forecasting.tbats import BATS, TBATS
except ModuleNotFoundError:
logger.warning(
logger.info(
"Support for AutoARIMA, BATS and TBATS is not available."
"To enable it, install u8darts[pmdarima] or u8darts[all]."
)

try:
from darts.models.forecasting.prophet_model import Prophet
except ModuleNotFoundError:
logger.warning(
logger.info(
"Support for Facebook Prophet is not available. "
'To enable it, install "darts", "u8darts[prophet]" or "u8darts[all]" (with pip);'
'or "u8darts-all" (with conda).'
Expand All @@ -50,7 +50,7 @@
from darts.models.forecasting.transformer_model import TransformerModel

except ModuleNotFoundError:
logger.warning(
logger.info(
"Support for Torch based models not available. "
'To enable them, install "darts", "u8darts[torch]" or "u8darts[all]" (with pip); '
'or "u8darts-torch" or "u8darts-all" (with conda).'
Expand All @@ -59,7 +59,7 @@
try:
from darts.models.forecasting.gradient_boosted_model import LightGBMModel
except ModuleNotFoundError:
logger.warning(
logger.info(
"Support for LightGBM not available."
"To enable LightGBM support in Darts, follow the detailed "
"install instructions for LightGBM in the README: "
Expand Down