fix: scope log filenames by service under root logs dir

This commit is contained in:
qzl
2026-02-25 10:39:47 +08:00
parent d16e66807d
commit a6b5d087f8
4 changed files with 37 additions and 17 deletions
@@ -83,7 +83,7 @@ def test_exception_handler_logs_stack_and_sends_500(tmp_path: Path) -> None:
assert response.status_code == 500
assert response.json()["detail"] == "Internal Server Error"
error_entries = _read_json_lines(Path(tmp_path) / "errors" / "error.log")
error_entries = _read_json_lines(Path(tmp_path) / "errors" / "app.error.log")
assert error_entries
entry = error_entries[-1]
assert entry["level"] == "error"
@@ -116,7 +116,7 @@ def test_invalid_request_id_is_replaced_and_used_in_error_context(
response_request_id = response.headers["X-Request-ID"]
assert response_request_id != "bad"
error_entries = _read_json_lines(Path(tmp_path) / "errors" / "error.log")
error_entries = _read_json_lines(Path(tmp_path) / "errors" / "app.error.log")
assert error_entries
entry = error_entries[-1]
assert entry["request_id"] == response_request_id