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

Provide a way to disable automatic flushing when using Target::Pipe #307

Open
quantatic opened this issue Feb 8, 2024 · 1 comment
Open

Comments

@quantatic
Copy link

quantatic commented Feb 8, 2024

When using Target::Pipe to log to a file (or another similar buffered output interface), the fact that we flush after each line causes a significant slowdown. It would be awesome to provide some sort of configuration mechanism to disable this automatic flushing after each line, letting the user force flushing at shutdown with log::logger().flush(), if necessary.

It looks like this automatic flushing logic was added here.

@epage
Copy link
Contributor

epage commented Feb 9, 2024

Automatic flushing is the right default due to concerns over crashing, reading pipes while writing continues, etc.

Allowing this to be configurable on the pipe definition would be a breaking change because we just accept a Box from the user and we'd need to change that type.

We could maybe make flushing a logger-wide setting though I'm mixed on that.

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

No branches or pull requests

2 participants