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) <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 4.8 committed 2026-08-12 10:58:19 +00:00
1 parent 5e0ab3423f
commit 42dc83df80
1 file changed
+20 -6
+20 -6
View File
@@ -68,6 +68,24 @@ function formatLog(info: Info, key: number): ReactElement {
return <span key={key}>[{level}] {info.message}<br/></span>;
}
/**
* 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)]
));