mirror of
https://github.com/Xevion/xevion.dev.git
synced 2026-01-31 04:26:43 -06:00
feat: add request ID propagation from Rust to Bun with structured logging
- Forward x-request-id header through proxy and API calls - Store RequestId in request extensions for downstream access - Add AsyncLocalStorage context to correlate logs across async boundaries - Improve migration logging to show pending changes before applying - Reduce noise in logs (common OG images, health checks)
This commit is contained in:
+13
-6
@@ -6,13 +6,20 @@ const API_SOCKET = "/tmp/api.sock";
|
||||
const PORT = process.env.PORT || "8080";
|
||||
const LOG_JSON = process.env.LOG_JSON || "true";
|
||||
|
||||
function tryUnlink(path: string) {
|
||||
try {
|
||||
unlinkSync(path);
|
||||
} catch (e) {
|
||||
// ENOENT is expected (socket doesn't exist yet), other errors are unexpected
|
||||
if (e instanceof Error && "code" in e && e.code !== "ENOENT") {
|
||||
console.error(`Failed to cleanup ${path}: ${e.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
try {
|
||||
unlinkSync(BUN_SOCKET);
|
||||
} catch {}
|
||||
try {
|
||||
unlinkSync(API_SOCKET);
|
||||
} catch {}
|
||||
tryUnlink(BUN_SOCKET);
|
||||
tryUnlink(API_SOCKET);
|
||||
}
|
||||
|
||||
// Cleanup on signals
|
||||
|
||||
Reference in New Issue
Block a user