Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flush cout buffer automatically #88

Merged
merged 1 commit into from
Aug 27, 2024
Merged

Conversation

BBaoVanC
Copy link
Contributor

Currently cout is never flushed. This is a problem because the actual flush timing is implementation defined and also changes whether it's piped or not. If you try to run hypridle | tee idle.log (simple example of trying to persist the log during development), then there is no log output.

This also means if hypridle were to crash, you don't lose all the messages that had the misfortune of not being already flushed.

Also looks like this same issue is present in Hyprland? Although over there it's less of an issue because of rollinglog and the file writer.

Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we flush it every single log or every few logs...?

@BBaoVanC
Copy link
Contributor Author

I would say every single log. If you don't then there's a chance (if your destination doesn't automatically flush; shells always do) during debugging that it looks like the program didn't reach a certain point before a crash when in reality, it just didn't get flushed.

@vaxerski
Copy link
Member

I guess, we don't log that much in hypridle anyways. sure.

@vaxerski vaxerski merged commit a46cd0b into hyprwm:main Aug 27, 2024
1 check passed
@BBaoVanC BBaoVanC deleted the flush-log-buffer branch August 27, 2024 19:21
@BBaoVanC
Copy link
Contributor Author

Can you consider making this change in Hyprland too (and others in the hypr ecosystem too)? I know in Hyprland there is rollinglog and file output which sidestep the issue, but I still think it might be confusing if someone tried piping the log output like any other program.

@vaxerski
Copy link
Member

some hyprapps produce a ton of logs esp when tracing and idk if flushing is a good idea

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