add structured logging and admin diagnostics to serve
- bincio.serve logger wired into uvicorn output: rebuild steps, upload
errors, strava-zip progress all now appear in the server log
- _trigger_rebuild: capture stdout/stderr, log errors instead of silently
discarding; exceptions logged with traceback instead of swallowed
- upload handler: log per-file errors with traceback; include error detail
in the SSE event sent back to the browser
- strava-zip handler: log imported/error counts on completion
- GET /api/admin/users/{handle}/diag: snapshot of a user's data dir
(file counts, sizes, index activity counts, pending uploads)
- POST /api/admin/users/{handle}/rebuild-sync: blocking rebuild that
returns full stdout/stderr — for debugging without SSH log access
- Admin page: Diag button per user opens a modal showing the diag JSON
This commit is contained in:
+8
-1
@@ -76,4 +76,11 @@ def serve(data_dir: str, site_dir: Optional[str], host: str, port: int,
|
||||
console.print(f" Users: [dim]unlimited[/dim]")
|
||||
console.print()
|
||||
|
||||
uvicorn.run(srv.app, host=host, port=port, log_level="info")
|
||||
log_config = uvicorn.config.LOGGING_CONFIG.copy()
|
||||
# Make bincio.serve logger emit at INFO through uvicorn's handler
|
||||
log_config["loggers"]["bincio.serve"] = {
|
||||
"handlers": ["default"],
|
||||
"level": "INFO",
|
||||
"propagate": False,
|
||||
}
|
||||
uvicorn.run(srv.app, host=host, port=port, log_level="info", log_config=log_config)
|
||||
|
||||
Reference in New Issue
Block a user