Blyp Docs

SvelteKit

Import from @blyp/core/sveltekit.

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.

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

Client ingestion route

// 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:

[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):

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