18 lines
482 B
TypeScript
Raw Permalink Normal View History

import { NextResponse } from 'next/server';
import { getGatewayLogs } from '@/lib/openclaw';
export async function GET(request: Request) {
try {
const { searchParams } = new URL(request.url);
const lines = parseInt(searchParams.get('lines') || '100', 10);
const logs = await getGatewayLogs(lines);
return NextResponse.json({ logs });
} catch (error) {
return NextResponse.json(
{ error: (error as Error).message },
{ status: 500 }
);
}
}