gitdataai/admin/src/app/api/platform/alerts/check/route.ts
ZhenYi 3773fdc780 feat(admin): add structured error logger for all API routes
Replace bare console.error() calls with logError() utility across all
47 API route handlers. logError() prints timestamp + context + message
+ stack trace + extra request data to stderr, and redacts sensitive
fields (password, token, secret, key, etc.) from logged objects.
2026-04-23 09:55:35 +08:00

20 lines
557 B
TypeScript

import { logError } from "@/lib/logger";
import { NextResponse } from "next/server";
import { checkAlerts } from "@/lib/adminrpc/client";
export const runtime = "nodejs";
/**
* Trigger workspace billing alert check via adminrpc gRPC.
*/
export async function POST() {
try {
const data = await checkAlerts();
return NextResponse.json(data);
} catch (e) {
const msg = e instanceof Error ? e.message : String(e);
logError("Alert check error:", e);
return NextResponse.json({ error: `检查失败: ${msg}` }, { status: 500 });
}
}