chore: clean up console upon firing up the CLI (#28134)

This commit is contained in:
Maxime Beauchemin 2024-04-23 11:43:39 -07:00 committed by GitHub
parent 063914af04
commit 68c77d6e9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 16 additions and 8 deletions

View File

@ -41,6 +41,8 @@ assists people when migrating to a new version.
- [27849](https://github.com/apache/superset/pull/27849/) More of an FYI, but we have a
new config `SLACK_ENABLE_AVATARS` (False by default) that works in conjunction with
set `SLACK_API_TOKEN` to fetch and serve Slack avatar links
- [28134](https://github.com/apache/superset/pull/28134/) The default logging level was changed
from DEBUG to INFO - which is the normal/sane default logging level for most software.
## 4.0.0

View File

@ -37,7 +37,8 @@ logger = logging.getLogger(__name__)
)
@with_appcontext
def superset() -> None:
"""This is a management script for the Superset application."""
"""\033[1;37mThe Apache Superset CLI\033[0m"""
# NOTE: codes above are ANSI color codes for bold white in CLI header ^^^
@app.shell_context_processor
def make_shell_context() -> dict[str, Any]:

View File

@ -20,6 +20,7 @@ All configuration in this file can be overridden by providing a superset_config
in your PYTHONPATH as there is a ``from superset_config import *``
at the end of this file.
"""
# mypy: ignore-errors
# pylint: disable=too-many-lines
from __future__ import annotations
@ -37,6 +38,7 @@ from email.mime.multipart import MIMEMultipart
from importlib.resources import files
from typing import Any, Callable, Literal, TYPE_CHECKING, TypedDict
import click
import pkg_resources
from celery.schedules import crontab
from flask import Blueprint
@ -274,7 +276,7 @@ SCHEDULED_QUERIES: dict[str, Any] = {}
# feature is on by default to make Superset secure by default, but you should
# fine tune the limits to your needs. You can read more about the different
# parameters here: https://flask-limiter.readthedocs.io/en/stable/configuration.html
RATELIMIT_ENABLED = True
RATELIMIT_ENABLED = os.environ.get("SUPERSET_ENV") == "production"
RATELIMIT_APPLICATION = "50 per second"
AUTH_RATE_LIMITED = True
AUTH_RATE_LIMIT = "5 per second"
@ -847,7 +849,7 @@ LOGGING_CONFIGURATOR = DefaultLoggingConfigurator()
# Console Log Settings
LOG_FORMAT = "%(asctime)s:%(levelname)s:%(name)s:%(message)s"
LOG_LEVEL = "DEBUG"
LOG_LEVEL = logging.INFO
# ---------------------------------------------------
# Enable Time Rotate Log Handler
@ -855,7 +857,7 @@ LOG_LEVEL = "DEBUG"
# LOG_LEVEL = DEBUG, INFO, WARNING, ERROR, CRITICAL
ENABLE_TIME_ROTATE = False
TIME_ROTATE_LOG_LEVEL = "DEBUG"
TIME_ROTATE_LOG_LEVEL = logging.INFO
FILENAME = os.path.join(DATA_DIR, "superset.log")
ROLLOVER = "midnight"
INTERVAL = 1
@ -1746,7 +1748,7 @@ if CONFIG_PATH_ENV_VAR in os.environ:
if key.isupper():
setattr(module, key, getattr(override_conf, key))
print(f"Loaded your LOCAL configuration at [{cfg_path}]")
click.secho(f"Loaded your LOCAL configuration at [{cfg_path}]", fg="cyan")
except Exception:
logger.exception(
"Failed to import config for %s=%s", CONFIG_PATH_ENV_VAR, cfg_path
@ -1758,7 +1760,10 @@ elif importlib.util.find_spec("superset_config") and not is_test():
import superset_config
from superset_config import * # noqa: F403, F401
print(f"Loaded your LOCAL configuration at [{superset_config.__file__}]")
click.secho(
f"Loaded your LOCAL configuration at [{superset_config.__file__}]",
fg="cyan",
)
except Exception:
logger.exception("Found but failed to import local superset_config")
raise

View File

@ -321,7 +321,7 @@ def get_event_logger_from_cfg_value(cfg_value: Any) -> AbstractEventLogger:
"of superset.utils.log.AbstractEventLogger."
)
logging.info("Configured event logger of type %s", type(result))
logging.debug("Configured event logger of type %s", type(result))
return cast(AbstractEventLogger, result)

View File

@ -65,4 +65,4 @@ class DefaultLoggingConfigurator( # pylint: disable=too-few-public-methods
)
logging.getLogger().addHandler(handler)
logger.info("logging was configured successfully")
logger.debug("logging was configured successfully")