logcast-sh
v0.1.2
Published
Next.js middleware for sending request logs to LogCast
Maintainers
Readme
logcast-sh
Next.js plugin that captures server logs and sends them to LogCast.
Intercepts the full Next.js log output (method, path, status, timing breakdown) and forwards it to your LogCast project.
Install
npm install logcast-shSetup
Create an instrumentation.ts file in your Next.js project root (or src/):
import { register as logcastRegister } from "logcast-sh";
export function register() {
logcastRegister({ apiKey: "your-api-key" });
}That's it. Every request log Next.js produces will be sent to LogCast.
Options
| Option | Required | Default | Description |
| ---------- | -------- | ---------------------------------- | ---------------------------- |
| apiKey | Yes | | Your LogCast project API key |
| endpoint | No | https://www.logcast.sh/api/logs | LogCast ingestion endpoint |
How it works
Next.js logs every request to stdout in this format:
GET / 200 in 84ms (next.js: 34ms, proxy.ts: 8ms, application-code: 41ms)logcast-sh hooks into process.stdout.write during server startup via Next.js instrumentation, parses these log lines, and sends them to the LogCast API.
License
ISC
