Feat : console log
This commit is contained in:
parent
50990e84b4
commit
4903a9b2cb
15 changed files with 323 additions and 30 deletions
24
src/app/api/translator/console-logs/route.js
Normal file
24
src/app/api/translator/console-logs/route.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { NextResponse } from "next/server";
|
||||
import { clearConsoleLogs, getConsoleLogs, initConsoleLogCapture } from "@/lib/consoleLogBuffer";
|
||||
|
||||
initConsoleLogCapture();
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const logs = getConsoleLogs();
|
||||
return NextResponse.json({ success: true, logs });
|
||||
} catch (error) {
|
||||
console.error("Error getting console logs:", error);
|
||||
return NextResponse.json({ success: false, error: error.message }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
export async function DELETE() {
|
||||
try {
|
||||
clearConsoleLogs();
|
||||
return NextResponse.json({ success: true });
|
||||
} catch (error) {
|
||||
console.error("Error clearing console logs:", error);
|
||||
return NextResponse.json({ success: false, error: error.message }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue