---
title: "SvelteKit"
description: "Attach Blyp through handle(), use event.locals.blypLog, and mount clientLogHandler in a server route."
canonical_url: "https://www.blyp.dev/docs/integrations/sveltekit"
markdown_url: "https://www.blyp.dev/docs/integrations/sveltekit.md"
last_updated: "2018-10-20"
x_farming_labs_generated_preamble: true
---

# SvelteKit
URL: /docs/integrations/sveltekit
LLM index: /llms.txt
Description: Attach Blyp through handle(), use event.locals.blypLog, and mount clientLogHandler in a server route.

# SvelteKit

Import from `@blyp/core/sveltekit`.

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

const svelteLogger = createLogger({
  level: "info",
});

export const handle = svelteLogger.handle;
```

Inside the request lifecycle, Blyp stores the logger on `event.locals.blypLog`.

```ts
// inside resolve(event)
event.locals.blypLog?.info("sveltekit-route");
```

## Client ingestion route

```ts
// src/routes/inngest/+server.ts
import { createLogger } from "@blyp/core/sveltekit";

const svelteLogger = createLogger();

export const POST = svelteLogger.clientLogHandler;
```

Like the Next.js and TanStack adapters, SvelteKit validates that the mounted route path matches the configured ingestion path.

## 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 {
  SvelteKitLoggerConfig,
  SvelteKitLoggerFactory,
  SvelteKitRequestEvent,
  SvelteKitLocals,
} from "@blyp/core/sveltekit";
```

## 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).
