import type { Level } from "../../lib/log"; // What a log line is drawn with — the level tags and the clock — shared by LogLine (both log // viewers) and the issue composer's review list, so a level reads the same everywhere. Apart from // LogLine.tsx because a component file exports only components (react-refresh). export const LEVEL_TAG: Record = { TRACE: { text: "TRACE", className: "text-muted opacity-80" }, DEBUG: { text: "DEBUG", className: "text-muted" }, INFO: { text: "INFO", className: "text-info" }, WARNING: { text: "WARN", className: "text-warn" }, ERROR: { text: "ERROR", className: "text-danger" }, CRITICAL: { text: "FATAL", className: "text-danger" }, }; /** `HH:MM:SS.mmm` in local time — a log is read to the millisecond. */ export function logClock(ts: string): string { const d = new Date(ts); const pad = (n: number, w = 2) => String(n).padStart(w, "0"); return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}.${pad(d.getMilliseconds(), 3)}`; }