Add log_level configuration to enhance logging flexibility (#8)

This commit is contained in:
2025-12-09 01:15:36 +01:00
committed by GitHub
parent 9c860c4f95
commit e5109fe02b
2 changed files with 3 additions and 1 deletions

View File

@@ -21,7 +21,7 @@ from http_server import HttpServer
from renderer.base import FlagRenderer from renderer.base import FlagRenderer
from renderer.manager import RendererManager from renderer.manager import RendererManager
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=getattr(logging, CONFIG.log_level.upper()))
intents = Intents.default() intents = Intents.default()
app = App( app = App(

View File

@@ -22,6 +22,7 @@ class Config(BaseModel):
uvicorn_host: str = "0.0.0.0" # noqa: S104 uvicorn_host: str = "0.0.0.0" # noqa: S104
auto_sync_commands: bool = True auto_sync_commands: bool = True
flagwaver_path: Path flagwaver_path: Path
log_level: str = "INFO"
CONFIG = Config( CONFIG = Config(
@@ -32,6 +33,7 @@ CONFIG = Config(
uvicorn_host=os.getenv("UVICORN_HOST", "0.0.0.0"), # noqa: S104 uvicorn_host=os.getenv("UVICORN_HOST", "0.0.0.0"), # noqa: S104
auto_sync_commands=os.getenv("AUTO_SYNC_COMMANDS", "true") == "true", auto_sync_commands=os.getenv("AUTO_SYNC_COMMANDS", "true") == "true",
flagwaver_path=Path(os.getenv("FLAGWAVER_PATH", Path(__file__).parent / "flagwaver" / "dist")), flagwaver_path=Path(os.getenv("FLAGWAVER_PATH", Path(__file__).parent / "flagwaver" / "dist")),
log_level=os.getenv("LOG_LEVEL", "INFO"),
) )
__all__ = ["CONFIG"] __all__ = ["CONFIG"]