@loglayer/fastify
v2.1.0
Published
Fastify integration for LogLayer with request-scoped logging, auto request logging, and error handling.
Maintainers
Readme
Fastify integration for LogLayer
A Fastify plugin for LogLayer that provides request-scoped logging with automatic request/response logging and error handling.
Installation
npm install @loglayer/fastifyUsage
import Fastify from "fastify";
import { LogLayer, StructuredTransport } from "loglayer";
import { fastifyLogLayer } from "@loglayer/fastify";
const log = new LogLayer({
transport: new StructuredTransport({ logger: console }),
});
const app = Fastify();
await app.register(fastifyLogLayer, { instance: log });
app.get("/", (request, reply) => {
request.log.info("Hello!");
reply.send("Hello World!");
});
await app.listen({ port: 3000 });Documentation
For more details, visit https://loglayer.dev/integrations/fastify
