From 8b35bb704463776b5acebdca5fd82816f6be1453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= <40151420+ldericher@users.noreply.github.com> Date: Thu, 8 Sep 2022 14:07:33 +0000 Subject: [PATCH] router startup log --- api/ovdashboard_api/routers/cal_aggregate.py | 8 ++++++++ api/ovdashboard_api/routers/calendar.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/api/ovdashboard_api/routers/cal_aggregate.py b/api/ovdashboard_api/routers/cal_aggregate.py index 036b3cf..cedc272 100644 --- a/api/ovdashboard_api/routers/cal_aggregate.py +++ b/api/ovdashboard_api/routers/cal_aggregate.py @@ -6,6 +6,7 @@ Router "cal_aggregate" provides: - getting aggregate calendar events by name prefix """ +from logging import getLogger from typing import Iterator from fastapi import APIRouter, Depends @@ -15,6 +16,8 @@ from ..dav_calendar import CalEvent, DavCalendar from ._common import CalAggregateLister, PrefixFinder, PrefixUnique from .calendar import calendar_unique +_logger = getLogger(__name__) + router = APIRouter(prefix="/aggregate", tags=["calendar"]) cal_aggregate_lister = CalAggregateLister() @@ -22,6 +25,11 @@ cal_aggregate_finder = PrefixFinder(cal_aggregate_lister) cal_aggregate_unique = PrefixUnique(cal_aggregate_finder) +@router.on_event("startup") +async def start_router() -> None: + _logger.debug(f"{router.prefix} router starting.") + + @router.get("/list", response_model=list[str]) async def list_aggregate_calendars( names: Iterator[str] = Depends(cal_aggregate_lister), diff --git a/api/ovdashboard_api/routers/calendar.py b/api/ovdashboard_api/routers/calendar.py index f2ab495..84d6e9b 100644 --- a/api/ovdashboard_api/routers/calendar.py +++ b/api/ovdashboard_api/routers/calendar.py @@ -6,6 +6,7 @@ Router "calendar" provides: - getting calendar events by calendar name prefix """ +from logging import getLogger from typing import Iterator from fastapi import APIRouter, Depends @@ -13,6 +14,8 @@ from fastapi import APIRouter, Depends from ..dav_calendar import CalEvent, DavCalendar from ._common import CalendarNameLister, PrefixFinder, PrefixUnique +_logger = getLogger(__name__) + router = APIRouter(prefix="/calendar", tags=["calendar"]) calendar_lister = CalendarNameLister() @@ -20,6 +23,11 @@ calendar_finder = PrefixFinder(calendar_lister) calendar_unique = PrefixUnique(calendar_finder) +@router.on_event("startup") +async def start_router() -> None: + _logger.debug(f"{router.prefix} router starting.") + + @router.get("/list", response_model=list[str]) async def list_calendars( names: Iterator[str] = Depends(calendar_lister),