diff --git a/app/config.py b/app/config.py index 20617ec..6e676ce 100644 --- a/app/config.py +++ b/app/config.py @@ -1,4 +1,5 @@ import logging +import logging.config from typing import Literal from pydantic import model_validator @@ -84,10 +85,64 @@ class _RepeatSquelch(logging.Filter): def setup_logging() -> None: """Configure logging for the application.""" - logging.basicConfig( - level=settings.log_level, - format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", - datefmt="%Y-%m-%d %H:%M:%S", + logging.config.dictConfig( + { + "version": 1, + "disable_existing_loggers": False, + "formatters": { + "default": { + "format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s", + "datefmt": "%Y-%m-%d %H:%M:%S", + }, + "uvicorn_default": { + "()": "uvicorn.logging.DefaultFormatter", + "fmt": "%(asctime)s - %(levelprefix)s %(message)s", + "datefmt": "%Y-%m-%d %H:%M:%S", + "use_colors": None, + }, + "uvicorn_access": { + "()": "uvicorn.logging.AccessFormatter", + "fmt": '%(asctime)s - %(levelprefix)s %(client_addr)s - "%(request_line)s" %(status_code)s', + "datefmt": "%Y-%m-%d %H:%M:%S", + "use_colors": None, + }, + }, + "handlers": { + "default": { + "class": "logging.StreamHandler", + "formatter": "default", + }, + "uvicorn_default": { + "class": "logging.StreamHandler", + "formatter": "uvicorn_default", + }, + "uvicorn_access": { + "class": "logging.StreamHandler", + "formatter": "uvicorn_access", + }, + }, + "root": { + "level": settings.log_level, + "handlers": ["default"], + }, + "loggers": { + "uvicorn": { + "level": settings.log_level, + "handlers": ["uvicorn_default"], + "propagate": False, + }, + "uvicorn.error": { + "level": settings.log_level, + "handlers": ["uvicorn_default"], + "propagate": False, + }, + "uvicorn.access": { + "level": settings.log_level, + "handlers": ["uvicorn_access"], + "propagate": False, + }, + }, + } ) # Squelch repeated messages from the meshcore library (e.g. rapid-fire # "Serial Connection started" when the port is contended). diff --git a/scripts/all_quality.sh b/scripts/all_quality.sh index 7ecc8d5..1cd2f5c 100755 --- a/scripts/all_quality.sh +++ b/scripts/all_quality.sh @@ -35,11 +35,6 @@ npm run lint:fix npm run format echo -e "${GREEN}[frontend lint]${NC} Passed!" -echo -e "${BLUE}[licenses]${NC} Regenerating LICENSES.md (always run)..." -cd "$SCRIPT_DIR" -bash scripts/collect_licenses.sh LICENSES.md -echo -e "${GREEN}[licenses]${NC} LICENSES.md updated" - echo -e "${GREEN}=== Phase 1 complete ===${NC}" echo diff --git a/scripts/publish.sh b/scripts/publish.sh index 912545c..a89cb50 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -58,6 +58,11 @@ echo -e "${GREEN}Frontend build complete!${NC}" cd "$SCRIPT_DIR" echo +echo -e "${YELLOW}Regenerating LICENSES.md...${NC}" +bash scripts/collect_licenses.sh LICENSES.md +echo -e "${GREEN}LICENSES.md updated!${NC}" +echo + # Prompt for version echo -e "${YELLOW}Current versions:${NC}" echo -n " pyproject.toml: "