Skip to content

Commit 36273a8

Browse files
committed
feat: configure server logging on startup
1 parent d5e5d75 commit 36273a8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/api/server_main.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
"""FastAPI server file"""
2+
import logging
3+
24
import uvicorn
35
from fastapi import FastAPI
46

57
from api.routers import map
8+
from dcd_mapping import dcd_mapping_version
9+
10+
logging.basicConfig(
11+
format="%(levelname)s:%(name)s:%(message)s",
12+
level=logging.INFO,
13+
force=True,
14+
)
15+
_logger = logging.getLogger(__name__)
616

717
app = FastAPI()
818

919
app.include_router(map.router)
1020

21+
msg = f"Starting DCD Mapping server v{dcd_mapping_version})"
22+
_logger.info(msg)
23+
1124

1225
# If the application is not already being run within a uvicorn server, start uvicorn here.
1326
if __name__ == "__main__":

0 commit comments

Comments
 (0)