Skip to content

Log lines are flushed as they are written - #145

Merged
eduardodoria merged 1 commit into
doriaxengine:mainfrom
WaruGameDev:fix/log-flush
Nov 24, 2026
Merged

eduardodoria merged 1 commit into
doriaxengine:mainfrom
WaruGameDev:fix/log-flush

Conversation

@WaruGameDev

Copy link
Copy Markdown
Contributor

Problem

System::platformLog (the default used on desktop) writes with printf and never flushes. When stdout is redirected to a file or a pipe it is fully buffered, and a window app has no console, so the lines written before a crash or a killed process are lost: the log file comes out empty, exactly when it is needed.

Fix

Flush stdout after each line. The platforms with their own platformLog are not touched.

Testing

The engine library builds with MSVC (VS 2022, Debug). The empty log was hit while debugging an app whose output was redirected to a file and the process was then stopped; flushing stdout (there via setvbuf(stdout, nullptr, _IONBF, 0) at startup) kept the lines.

🤖 Generated with Claude Code

System::platformLog wrote with printf and never flushed. stdout is fully
buffered when it is redirected to a file or a pipe, and a window app has no
console, so the lines written before a crash or a killed process were lost
(an empty log file). Each line is now flushed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eduardodoria
eduardodoria merged commit e113dec into doriaxengine:main Nov 24, 2026
0 of 2 checks passed
@eduardodoria

Copy link
Copy Markdown
Contributor

Merged. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants