Skip to content

Commit

Permalink
chore: clean up console upon firing up the CLI (apache#28134)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch authored and jzhao62 committed May 16, 2024
1 parent 705fc41 commit 98528a6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
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 @@ -274,7 +276,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 @@ -847,15 +849,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 @@ -1746,7 +1748,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 @@ -1758,7 +1760,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 @@ -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)


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")

0 comments on commit 98528a6

Please sign in to comment.