From b5733657f9fb92c5ccb049f5e056a4fea931d5e0 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Fri, 18 Sep 2026 19:07:33 +0000 Subject: [PATCH] Fastapi-vue-setup 1.7.2 logging fixes. --- pyproject.toml | 2 +- scripts/fastapi-vue/buildutil.py | 23 ++++++++++------------- scripts/fastapi-vue/devutil.py | 2 +- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 36acd44..3108291 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,7 +21,7 @@ dependencies = [ "pyjwt[crypto]>=2.11.0", "jsondiff>=2.2.1", "msgspec>=0.20.0", - "fastapi-vue~=1.7.1", + "fastapi-vue~=1.7.2", "kanta>=0.9.2", "uarite>=0.2.1", ] diff --git a/scripts/fastapi-vue/buildutil.py b/scripts/fastapi-vue/buildutil.py index 5241b00..95759d6 100644 --- a/scripts/fastapi-vue/buildutil.py +++ b/scripts/fastapi-vue/buildutil.py @@ -10,23 +10,20 @@ from pathlib import Path MIN_NODE_VERSION = 20 -# Duplicated from fastapi_vue.logging because build environment is isolated -_LEVEL_EMOJI = { - logging.DEBUG: "🐛", - logging.INFO: "🔷", - logging.WARNING: "❗", - logging.ERROR: "🛑", - logging.CRITICAL: "🚨", -} - class _Formatter(logging.Formatter): - """Emoji level prefix formatter, mirroring fastapi_vue.logging.Formatter.""" + """Prefix formatter, intentionally different from fastapi_vue.logging. + + INFO and below pass through unprefixed so messages can use their own + markings (>>>, ###); WARNING and above get an emoji prefix. + """ def format(self, record: logging.LogRecord) -> str: - emoji = _LEVEL_EMOJI.get(record.levelno) - prefix = f"{emoji} " if emoji else f"{record.levelname}: " - return prefix + record.getMessage() + if record.levelno >= logging.ERROR: + return f"🛑 {record.getMessage()}" + if record.levelno >= logging.WARNING: + return f"💣 {record.getMessage()}" + return record.getMessage() _handler = logging.StreamHandler() diff --git a/scripts/fastapi-vue/devutil.py b/scripts/fastapi-vue/devutil.py index eeb2587..3ebbd74 100644 --- a/scripts/fastapi-vue/devutil.py +++ b/scripts/fastapi-vue/devutil.py @@ -139,7 +139,7 @@ async def ready(url: str, path: str = "", max_attempts: int = 50) -> None: for attempt in range(max_attempts): if await http_get_server(f"{url}{path}", timeout=1.0) is not None: - logger.info("✓ Backend ready!") + logger.info("🟢 Backend ready!") return if attempt == max_attempts - 1: logger.error("Backend at %s didn't start in time", url)