Elysia
Import from @blyp/core/elysia.
import { Elysia } from "elysia";
import { createLogger } from "@blyp/core/elysia";
const app = new Elysia()
.use(createLogger({
level: "debug",
customProps: (ctx) => ({
framework: "elysia",
path: ctx.path,
}),
}))
.get("/hello", ({ log }) => {
log.info("elysia-route");
return "ok";
});How it works
- Blyp decorates the app with
log - request timing starts per request
- success responses emit
http_request - failures emit
http_error - when enabled, client logs are accepted on the configured ingestion path
What auto-logged requests look like
With automatic request logging enabled, Blyp emits terminal output like:
[INFO] GET /health 200 2ms
[INFO] POST /checkout 200 143ms
[INFO] GET /users/42 404 8ms
[ERROR] POST /payments 500 1203msFields included automatically: method, path, status code, and duration.
In production (NDJSON):
{"level":"info","time":1710000000000,"msg":"GET /health","type":"http_request","method":"GET","url":"/health","statusCode":200,"responseTime":2}
{"level":"info","time":1710000000001,"msg":"POST /checkout","type":"http_request","method":"POST","url":"/checkout","statusCode":200,"responseTime":143}Relevant types
import type {
ElysiaLoggerConfig,
ElysiaContext,
ResolveCtx,
} from "@blyp/core/elysia";