---
title: "Fastify"
description: "Register Blyp as a Fastify plugin and use request.blypLog inside handlers."
canonical_url: "https://www.blyp.dev/docs/integrations/fastify"
markdown_url: "https://www.blyp.dev/docs/integrations/fastify.md"
last_updated: "2018-10-20"
x_farming_labs_generated_preamble: true
---

# Fastify
URL: /docs/integrations/fastify
LLM index: /llms.txt
Description: Register Blyp as a Fastify plugin and use request.blypLog inside handlers.

# Fastify

Import from `@blyp/core/fastify`.

```ts
import Fastify from "fastify";
import { createLogger } from "@blyp/core/fastify";

const app = Fastify();

await app.register(createLogger({
  level: "info",
}));

app.get("/hello", async (request) => {
  request.blypLog.info("fastify-route");
  return { ok: true };
});
```

## What Blyp decorates

- `request.blypLog`
- `request.blypStartTime`
- `request.blypError`

The adapter logs in `onResponse`, records thrown failures from `onError`, and registers the client ingestion route when enabled.

## What auto-logged requests look like

With automatic request logging enabled, Blyp emits terminal output like:

```text
[INFO]  GET  /health        200  2ms
[INFO]  POST /checkout      200  143ms
[INFO]  GET  /users/42      404  8ms
[ERROR] POST /payments      500  1203ms
```

Fields included automatically: method, path, status code, and duration.

**In production (NDJSON):**

```json
{"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

```ts
import type {
  FastifyLoggerConfig,
  FastifyLoggerPlugin,
} from "@blyp/core/fastify";
```

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
Docs-scoped sitemap: [/docs/sitemap.md](/docs/sitemap.md).
Well-known sitemap: [/.well-known/sitemap.md](/.well-known/sitemap.md).
