diff --git a/flaml/__init__.py b/flaml/__init__.py index 8664127e3a..2d7bfadfdc 100644 --- a/flaml/__init__.py +++ b/flaml/__init__.py @@ -1,4 +1,5 @@ import logging +import warnings try: from flaml.automl import AutoML, logger_formatter @@ -12,7 +13,8 @@ # Set the root logger. logger = logging.getLogger(__name__) -logger.setLevel(logging.INFO) +if logger.level == logging.NOTSET: + logger.setLevel(logging.INFO) if not has_automl: - logger.warning("flaml.automl is not available. Please install flaml[automl] to enable AutoML functionalities.") + warnings.warn("flaml.automl is not available. Please install flaml[automl] to enable AutoML functionalities.")