@loglayer/koa
v1.0.0
Published
Koa integration for LogLayer with request-scoped logging, auto request logging, and error handling.
Maintainers
Readme
Koa integration for LogLayer
A Koa middleware for LogLayer that provides request-scoped logging with automatic request/response logging and error handling.
Installation
npm install @loglayer/koaUsage
import Koa from "koa";
import { LogLayer, StructuredTransport } from "loglayer";
import { koaLogLayer } from "@loglayer/koa";
const log = new LogLayer({
transport: new StructuredTransport({ logger: console }),
});
const app = new Koa();
app.use(koaLogLayer({ instance: log }));
app.use((ctx) => {
ctx.log.info("Hello!");
ctx.body = "Hello World!";
});
app.listen(3000);Documentation
For more details, visit https://loglayer.dev/integrations/koa
