Blyp Docs

Next.js App Router

Import from blyp-js/nextjs.

import { createLogger } from "blyp-js/nextjs";

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

export const GET = nextLogger.withLogger(async (_request, _context, { log }) => {
  log.info("next-route");
  return Response.json({ ok: true });
});

Client ingestion route

Mount clientLogHandler on the same path configured for client logging.

// app/inngest/route.ts
import { createLogger } from "blyp-js/nextjs";

const nextLogger = createLogger();

export const POST = nextLogger.clientLogHandler;

If you mount the handler on a path that does not match the configured ingestion path, Blyp returns a 500 mismatch response.

Relevant types

import type {
  NextJsLoggerConfig,
  NextJsLoggerFactory,
  NextJsHandlerWithLogger,
  NextJsRouteContext,
} from "blyp-js/nextjs";

On this page

No Headings