Spaces:
Sleeping
Sleeping
ktsn-ud commited on
Commit ·
b77fa8d
1
Parent(s): f39c719
各API呼び出しに対してログ出力を追加
Browse files- app/main.py +4 -0
app/main.py
CHANGED
|
@@ -75,6 +75,7 @@ def root():
|
|
| 75 |
|
| 76 |
@app.get("/api/health")
|
| 77 |
def health_check():
|
|
|
|
| 78 |
return {"status": "ok"}
|
| 79 |
|
| 80 |
|
|
@@ -90,6 +91,7 @@ def get_summary_data():
|
|
| 90 |
for p in engine.get_projects()
|
| 91 |
]
|
| 92 |
content = json.dumps(summaries, ensure_ascii=False).encode("utf-8")
|
|
|
|
| 93 |
return Response(
|
| 94 |
content=gzip.compress(content),
|
| 95 |
headers={"Content-Encoding": "gzip", "Content-Type": "application/json"},
|
|
@@ -106,6 +108,7 @@ def get_project_detail(projectId: str = Query(..., description="取得したい
|
|
| 106 |
if not p:
|
| 107 |
raise HTTPException(status_code=404, detail="Project not found")
|
| 108 |
fields = set(schema_projects.ProjectDetail.model_fields.keys())
|
|
|
|
| 109 |
return {k: v for k, v in p.items() if k in fields}
|
| 110 |
|
| 111 |
|
|
@@ -152,4 +155,5 @@ def search(request: SearchRequest):
|
|
| 152 |
except Exception:
|
| 153 |
pass
|
| 154 |
|
|
|
|
| 155 |
return schema_projects.ProjectIds(projectIds=ids)
|
|
|
|
| 75 |
|
| 76 |
@app.get("/api/health")
|
| 77 |
def health_check():
|
| 78 |
+
log.info("Health check OK")
|
| 79 |
return {"status": "ok"}
|
| 80 |
|
| 81 |
|
|
|
|
| 91 |
for p in engine.get_projects()
|
| 92 |
]
|
| 93 |
content = json.dumps(summaries, ensure_ascii=False).encode("utf-8")
|
| 94 |
+
log.info(f"Project summaries fetched: {len(summaries)} items")
|
| 95 |
return Response(
|
| 96 |
content=gzip.compress(content),
|
| 97 |
headers={"Content-Encoding": "gzip", "Content-Type": "application/json"},
|
|
|
|
| 108 |
if not p:
|
| 109 |
raise HTTPException(status_code=404, detail="Project not found")
|
| 110 |
fields = set(schema_projects.ProjectDetail.model_fields.keys())
|
| 111 |
+
log.info(f"Project detail fetched: {projectId}")
|
| 112 |
return {k: v for k, v in p.items() if k in fields}
|
| 113 |
|
| 114 |
|
|
|
|
| 155 |
except Exception:
|
| 156 |
pass
|
| 157 |
|
| 158 |
+
log.info(f'Search query="{request.query}" => {len(ids)} results')
|
| 159 |
return schema_projects.ProjectIds(projectIds=ids)
|