Observability
Request IDs
Section titled “Request IDs”Every request gets an ID, returned in the X-Request-Id response header and available as c.id. When a client or proxy sends a sane X-Request-Id (short and printable), it is reused, so one ID can follow a request across services.
kaelum({ observability: { requestId: { header: "X-Correlation-Id", generate: () => nanoid() }, },});Turn it off with requestId: false.
Request logs
Section titled “Request logs”One line per request, written when the response finishes:
GET /users 200 1.997 ms - 76Default: "dev" (colored status) in development, "tiny" (same line, no colors) in production, off when NODE_ENV is test. Set it with observability.logs: true, false, "dev" or "tiny".
Logger
Section titled “Logger”app.log and c.log have four levels and take an optional object of fields:
app.log.info("cache warmed", { entries: 1200 });
app.get("/orders/:id", (c) => { c.log.debug("loading order", { id: c.params.id }); // ...});Records written through c.log carry the request ID. Unhandled errors are logged with it too.
By default records go to the console in development, and as one JSON object per line in production, which log collectors can parse:
{"level":"error","time":"2026-11-18T10:21:03.112Z","requestId":"5f0c...","message":"Unhandled error in GET /orders/7","err":{"name":"Error","message":"connection refused","stack":"..."}}To send records elsewhere, pass a sink. It receives { level, message, time, requestId?, data? }:
import pino from "pino";
const log = pino();
kaelum({ observability: { logger: ({ level, message, requestId, data }) => log[level]({ requestId, ...data }, message), },});Server-Timing
Section titled “Server-Timing”kaelum({ observability: { timing: true } });Adds Server-Timing: total;dur=12.34 to every response. Browser dev tools show it in the network panel. Options: headerName, precision.
Health check
Section titled “Health check”GET /health answers { "status": "ok" }. Point load balancers and orchestrators at it. Add a readiness check so the instance is taken out of rotation when a dependency is down:
kaelum({ health: { check: () => db.ping() } });A thrown error or a false result answers 503. See Configuration.