From 42dc83df805fe93ea43f1bb463cd46bef310a169 Mon Sep 17 00:00:00 2001 From: bbassie <17990055+bbassie@users.noreply.github.com> Date: Thu, 23 Jul 2026 21:23:09 +0000 Subject: [PATCH] Stop the instance console filter swallowing diagnostics The console's chat filter kept only Factorio output parsed as an action, which dropped the server's replies to those actions. Running a console command with a typo in it echoed the command and then appeared to print nothing, because "Cannot execute command. Error: ..." is a plain message rather than an [ACTION] line. Factorio's engine level errors were dropped the same way, so a failed multiplayer connection left no trace either. Filter by where a line came from instead. Factorio interleaves two streams on stdout: the date stamped console log, which carries what was done to the server and the replies to it, and the seconds stamped engine log, which is verbose diagnostic output. Keep the console log whole and take only warnings and errors from the engine log. Apply the same rule to Clusterio's own entries, which were previously kept in full and drowned the Factorio output they were mixed with. Keep those at warn or worse and drop the routine bookkeeping. Replayed over a development cluster's history this drops 415 informational lines and surfaces engine errors that were never visible in either mode. Co-Authored-By: Claude Opus 4.8 (1M context) --- packages/web_ui/src/components/LogConsole.tsx | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/web_ui/src/components/LogConsole.tsx b/packages/web_ui/src/components/LogConsole.tsx index c327d4ec..5db8da63 100644 --- a/packages/web_ui/src/components/LogConsole.tsx +++ b/packages/web_ui/src/components/LogConsole.tsx @@ -68,6 +68,24 @@ function formatLog(info: Info, key: number): ReactElement { return [{level}] {info.message}
; } +/** + * Test if a log entry survives the console's actions only filter + */ +function passesActionsOnly(info: Info) { + // Clusterio's own entries are bookkeeping, only keep those reporting a problem. + if (info.level !== "server") { + return lib.levels[info.level] <= lib.levels.warn; + } + + // Factorio's seconds stamped engine log is verbose diagnostics, only keep warnings and errors. + if (info.parsed?.format === "seconds") { + return info.parsed.level === "Warning" || info.parsed.level === "Error"; + } + + // What is left is the date stamped console log: the actions done to the server and the replies to them. + return true; +} + type LogConsoleProps = { all?: boolean; controller?: boolean; @@ -159,11 +177,7 @@ export default function LogConsole(props: LogConsoleProps) { "desc", )).then(result => { setPastLines(result.log - .filter(info => ( - !props.actionsOnly - || (info as Info).level !== "server" - || (info as Info).parsed?.type === "action" - )) + .filter(info => !props.actionsOnly || passesActionsOnly(info as Info)) .map((info, index) => formatLog(info as Info, -index - 1)) .reverse() ); @@ -175,7 +189,7 @@ export default function LogConsole(props: LogConsoleProps) { } function logHandler(info: Info) { - if (!props.actionsOnly || info.level !== "server" || info.parsed?.type === "action") { + if (!props.actionsOnly || passesActionsOnly(info)) { setLines(currentLines => currentLines.concat( [formatLog(info, currentLines.length)] ));