vibe-app-logger for structured app logs + audit logs. Admin-visible. Graylog-ready.
Every API call, every error, every warning — structured, searchable, and visible in the admin dashboard. No logging infrastructure to set up. No configuration files.
The MVP includes vibe-app-logger, a structured logging utility that outputs JSON-formatted log entries with consistent fields: timestamp, level, message, request context (method, path, user ID), and duration.
API routes wrapped in withApiLogging() automatically log request start, response status, execution time, and any errors. You get structured logs for every API call without writing log statements.
Logs are visible in the admin dashboard's Logs tab — searchable by level, path, user, and time range. During development, this gives you instant visibility without setting up external tools.
For production, logs output to stdout in structured JSON format — ready for Graylog, Datadog, CloudWatch, or any log aggregation tool that accepts structured JSON.
Every log entry is a JSON object with consistent fields. This matters because structured logs are searchable and filterable — unlike plain text logs where you're grepping through strings. The structure is opinionated: every entry has a timestamp, level, message, and context object. The context includes request-specific data (method, path, user ID, IP, duration) when logging from an API route.
// What a structured log entry looks like
{
"timestamp": "2026-03-11T14:30:00.123Z",
"level": "info",
"message": "POST /api/orders completed",
"context": {
"method": "POST",
"path": "/api/orders",
"status": 201,
"duration": 45,
"userId": 42,
"ip": "203.0.113.42",
"requestId": "req_abc123"
}
}
// Error logs include stack traces
{
"timestamp": "2026-03-11T14:30:01.456Z",
"level": "error",
"message": "Failed to process order",
"context": {
"method": "POST",
"path": "/api/orders",
"status": 500,
"duration": 12,
"userId": 42,
"error": "Insufficient credits",
"stack": "Error: Insufficient credits\n at ..."
}
}Wrap any API route handler with withApiLogging() and it automatically logs the request lifecycle. No log statements in your code — the wrapper handles entry, exit, timing, and error capture.
import { withApiLogging } from '@payez/next-mvp';
// Automatic logging — you write zero log statements
export const POST = withApiLogging(
async (req: Request) => {
const body = await req.json();
const order = await createOrder(body);
return Response.json(order, { status: 201 });
}
);
// This generates:
// INFO POST /api/orders started {userId: 42}
// INFO POST /api/orders completed {status: 201, duration: 45ms}
// On error:
// ERROR POST /api/orders failed {status: 500, error: "...", stack: "..."}For logging within your business logic (not just request lifecycle), use the logger directly. It accepts the same structured format and the entries appear in the admin dashboard alongside the automatic logs.
import { logger } from '@payez/next-mvp';
// In your code
logger.info('Order created', {
orderId: order.id,
amount: order.amount,
userId: session.userId,
});
logger.warn('Credit balance low', {
userId: session.userId,
remaining: 5,
threshold: 10,
});
logger.error('Payment provider timeout', {
provider: 'stripe',
orderId: order.id,
timeout: 30000,
});The Logs tab in the admin dashboard renders your structured logs as a searchable, filterable feed. Filter by: - Level: info, warn, error - Path: /api/orders, /api/users/* - User ID: see all logs for a specific user - Time range: last hour, last 24 hours, custom range This is especially useful during development — you get a visual log viewer without configuring Graylog or Datadog. In production, you'll likely use both: the admin Logs tab for quick checks and your log aggregation tool for deep analysis.
In production, vibe-app-logger outputs to stdout in structured JSON. Your container runtime (Docker, Kubernetes) captures stdout and forwards it to your log aggregation tool. For Graylog specifically, the JSON format maps cleanly to GELF fields. For Datadog, the JSON is auto-parsed. For CloudWatch, use the JSON log format configuration. No adapters or plugins needed — structured JSON is the universal format.
Structured Logging ships with every @payez/next-mvp install. 10K MAU free. No credit card required.