update to nuxt 4

This commit is contained in:
DecDuck
2025-09-20 11:20:49 +10:00
parent b4f9b77809
commit 2db8e753b7
313 changed files with 508 additions and 512 deletions

31
app/utils/parseTaskLog.ts Normal file
View File

@ -0,0 +1,31 @@
import type { TaskLog } from "~~/server/internal/tasks";
const labelNumberMap = {
100: "silent",
60: "fatal",
50: "error",
40: "warn",
30: "info",
20: "debug",
10: "trace",
0: "off",
};
export function parseTaskLog(
logStr?: string | undefined,
): typeof TaskLog.infer {
if (!logStr) return { message: "", timestamp: "", level: "" };
const log = JSON.parse(logStr);
if (typeof log.level === "number") {
log.level = labelNumberMap[
log.level as keyof typeof labelNumberMap
] as string;
}
return {
message: log.msg,
timestamp: log.time,
level: log.level,
};
}