From 963b4b8567ac1bd8b23c41e1bfbd6a99d202d1ed Mon Sep 17 00:00:00 2001 From: HsiangNianian <44714368+HsiangNianian@users.noreply.github.com> Date: Fri, 16 Jan 2026 01:35:23 +0000 Subject: style: auto format and lint fix [skip ci] --- ui/src/stores/logs.svelte.ts | 46 ++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 19 deletions(-) (limited to 'ui/src/stores/logs.svelte.ts') diff --git a/ui/src/stores/logs.svelte.ts b/ui/src/stores/logs.svelte.ts index 5491f70..5df9abc 100644 --- a/ui/src/stores/logs.svelte.ts +++ b/ui/src/stores/logs.svelte.ts @@ -17,7 +17,14 @@ function parseGameLogLevel(levelStr: string): LogEntry["level"] { if (upper === "INFO") return "info"; if (upper === "WARN" || upper === "WARNING") return "warn"; if (upper === "ERROR" || upper === "SEVERE") return "error"; - if (upper === "DEBUG" || upper === "TRACE" || upper === "FINE" || upper === "FINER" || upper === "FINEST") return "debug"; + if ( + upper === "DEBUG" || + upper === "TRACE" || + upper === "FINE" || + upper === "FINER" || + upper === "FINEST" + ) + return "debug"; if (upper === "FATAL") return "fatal"; return "info"; } @@ -37,8 +44,9 @@ export class LogsState { addLog(level: LogEntry["level"], source: string, message: string) { const now = new Date(); - const timestamp = now.toLocaleTimeString() + "." + now.getMilliseconds().toString().padStart(3, "0"); - + const timestamp = + now.toLocaleTimeString() + "." + now.getMilliseconds().toString().padStart(3, "0"); + this.logs.push({ id: this.nextId++, timestamp, @@ -60,7 +68,7 @@ export class LogsState { // Parse game output and extract level/source addGameLog(rawLine: string, isStderr: boolean) { const match = rawLine.match(GAME_LOG_REGEX); - + if (match) { const [, thread, levelStr, extraSource, message] = match; const level = parseGameLogLevel(levelStr); @@ -105,33 +113,33 @@ export class LogsState { // Download Events (Summarized) await listen("download-start", (e) => { - this.addLog("info", "Downloader", `Starting batch download of ${e.payload} files...`); + this.addLog("info", "Downloader", `Starting batch download of ${e.payload} files...`); }); await listen("download-complete", () => { - this.addLog("info", "Downloader", "All downloads completed."); + this.addLog("info", "Downloader", "All downloads completed."); }); // Listen to file download progress to log finished files await listen("download-progress", (e) => { - const p = e.payload; - if (p.status === "Finished") { - if (p.file.endsWith(".jar")) { - this.addLog("info", "Downloader", `Downloaded ${p.file}`); - } + const p = e.payload; + if (p.status === "Finished") { + if (p.file.endsWith(".jar")) { + this.addLog("info", "Downloader", `Downloaded ${p.file}`); } + } }); // Java Download await listen("java-download-progress", (e) => { - const p = e.payload; - if (p.status === "Downloading" && p.percentage === 0) { - this.addLog("info", "JavaInstaller", `Downloading Java: ${p.file_name}`); - } else if (p.status === "Completed") { - this.addLog("info", "JavaInstaller", `Java installed: ${p.file_name}`); - } else if (p.status === "Error") { - this.addLog("error", "JavaInstaller", `Java download error`); - } + const p = e.payload; + if (p.status === "Downloading" && p.percentage === 0) { + this.addLog("info", "JavaInstaller", `Downloading Java: ${p.file_name}`); + } else if (p.status === "Completed") { + this.addLog("info", "JavaInstaller", `Java installed: ${p.file_name}`); + } else if (p.status === "Error") { + this.addLog("error", "JavaInstaller", `Java download error`); + } }); } } -- cgit v1.2.3-70-g09d2