Make logging setup consistent between redbot and redbot-setup (#6695)

Co-authored-by: Michael Oliveira <34169552+Flame442@users.noreply.github.com>
This commit is contained in:
Jakub Kuczys
2026-04-19 21:41:50 +02:00
committed by GitHub
parent 2ea4c766ad
commit 70faa8cd52
3 changed files with 40 additions and 26 deletions

View File

@@ -14,6 +14,7 @@ from typing import Dict, Any, Optional, Union
import click
import redbot.logging
from redbot.core._cli import confirm
from redbot.core.utils._internal_utils import (
safe_delete,
@@ -436,15 +437,9 @@ def cli(
overwrite_existing_instance: bool,
) -> None:
"""Create a new instance."""
level = cli_level_to_log_level(debug)
base_logger = logging.getLogger("red")
base_logger.setLevel(level)
formatter = logging.Formatter(
"[{asctime}] [{levelname}] {name}: {message}", datefmt="%Y-%m-%d %H:%M:%S", style="{"
)
stdout_handler = logging.StreamHandler(sys.stdout)
stdout_handler.setFormatter(formatter)
base_logger.addHandler(stdout_handler)
redbot.logging.init_logging(level)
if ctx.invoked_subcommand is None:
basic_setup(