26 lines
545 B
Python
26 lines
545 B
Python
from fastapi import APIRouter
|
|
import logging
|
|
|
|
|
|
#Logging
|
|
|
|
logging.basicConfig(
|
|
filename='api.log', # Log to a file
|
|
level=logging.DEBUG, # Log everything (DEBUG and above)
|
|
format='%(asctime)s %(levelname)s %(message)s'
|
|
)
|
|
|
|
logging.info('Application started')
|
|
try:
|
|
logging.debug('Debug info here')
|
|
except Exception as e:
|
|
logging.exception('An error occurred')
|
|
|
|
|
|
router = APIRouter(prefix="/health", tags=["health"])
|
|
|
|
|
|
@router.get("/")
|
|
def health_check():
|
|
logging.info("get health check request")
|
|
return {"status": "ok"} |