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

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

Merged
merged 5 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion superset/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
)
@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]:
Expand Down
15 changes: 10 additions & 5 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
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
Expand All @@ -37,6 +38,7 @@
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
Expand Down Expand Up @@ -271,7 +273,7 @@ def _try_json_readsha(filepath: str, length: int) -> str | None:
# 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"
Expand Down Expand Up @@ -844,15 +846,15 @@ class D3Format(TypedDict, total=False):
# 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
# ---------------------------------------------------
# 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
Expand Down Expand Up @@ -1743,7 +1745,7 @@ class ExtraDynamicQueryFilters(TypedDict, total=False):
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
Expand All @@ -1755,7 +1757,10 @@ class ExtraDynamicQueryFilters(TypedDict, total=False):
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
2 changes: 1 addition & 1 deletion superset/utils/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,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)


Expand Down
2 changes: 1 addition & 1 deletion superset/utils/logging_configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ def configure_logging(
)
logging.getLogger().addHandler(handler)

logger.info("logging was configured successfully")
logger.debug("logging was configured successfully")
Loading