Skip to content

Conversation

@Techcable
Copy link
Member

@Techcable Techcable commented Aug 9, 2025

This is simpler than the API in #332, but requires more work by slog_async to implement it.

See the implementation in slog-rs/async#39

All other slog libraries have a trivial implementation of this, so I will wait to add those those until (and if) this is accepted.

@Techcable Techcable force-pushed the feature/simple-flush-method branch 2 times, most recently from 5eda5fd to 901137d Compare August 9, 2025 21:36
Techcable added a commit to Techcable/slog-json that referenced this pull request Aug 9, 2025
Requires slog-rs/slog#349 to be accepted first.
Techcable added a commit to Techcable/slog-json that referenced this pull request Aug 9, 2025
Requires slog-rs/slog#349 to be accepted first.
Techcable added a commit to Techcable/slog-json that referenced this pull request Aug 9, 2025
Pinned to the branch used in slog-rs/slog#349, so that must be accepted first.
The 'pretty' example is pinned to use the branch in slog-rs/async#39,
so that must also be accepted first.
@dpc
Copy link
Collaborator

dpc commented Aug 11, 2025

The goal here is to propagate any errors from the inside of the logging?

The interface doesn't say anything about calling it multiple times. Probably good idea to say something, even if "is unspecified".

@Techcable
Copy link
Member Author

Techcable commented Aug 13, 2025

A withdrawn proposal on a `FlushRequest` enum (too complex), }, NonBlocking, } ```

Blocking with a timeout or nonblocking flush only makes sense with slog_async, so I'm not sure if it is worthwhile.

EDIT: For simplicity and consistency with std::io::Write, I am sticking with the simple interface.

The goal here is to propagate any errors from the inside of the logging?

The goal is to flush buffered streams. Setting up a serde_json::Json with the default settings does not flush output by default, potentially losing messages if the program exits. A similar problem can happen with slog_async, and this is easier to use than an AsyncGuard.

The interface doesn't say anything about calling it multiple times. Probably good idea to say something, even if "is unspecified".

Flushing should be idempotent. I will add this to the docs.

@Techcable Techcable marked this pull request as draft August 13, 2025 03:33
@Techcable Techcable force-pushed the feature/simple-flush-method branch from ddc4252 to 52e5bc0 Compare September 25, 2025 04:04
@Techcable Techcable marked this pull request as ready for review September 25, 2025 04:05
@Techcable
Copy link
Member Author

I have provided much more detailed documentation & made Duplicate::flush more robust.

@Techcable Techcable force-pushed the feature/simple-flush-method branch from 52e5bc0 to 9d7359e Compare September 25, 2025 04:06
@Techcable Techcable requested a review from dpc September 26, 2025 06:54
@Techcable Techcable force-pushed the feature/simple-flush-method branch from 9d7359e to 9406aa7 Compare September 27, 2025 23:37
This is simpler than the API in slog-rs#332 ,
but requires more work by slog_async to implement it.
Requires either `feature = "std"` or core::error::Error (rust >= 1.81)
@Techcable Techcable force-pushed the feature/simple-flush-method branch from 9406aa7 to a59a459 Compare September 27, 2025 23:48
@Techcable Techcable merged commit a59a459 into slog-rs:master Sep 27, 2025
42 checks passed
Techcable added a commit to Techcable/slog.rs that referenced this pull request Sep 28, 2025
Different from simple flush in PR slog-rs#349
@Techcable Techcable deleted the feature/simple-flush-method branch October 2, 2025 05:07
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