Skip to content

docs(examples): add multi-logger shared-sink pipeline example - #335

Merged
tisonkun merged 2 commits into
mainfrom
docs/multi-logger-pipeline-example
Dec 3, 2026
Merged

tisonkun merged 2 commits into
mainfrom
docs/multi-logger-pipeline-example

Conversation

@tisonkun

@tisonkun tisonkun commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a runnable multi_logger_pipeline example in examples showing how applications with multiple domain Logger channels (general, query, compaction) share Arc sinks (Async JSON output and Stderr alerts) with independent per-channel filters and diagnostics.
  • Return a FlushGuard owning the deduplicated Vec<Arc<dyn Append>> sink list from the initialization boundary so subsystems only emit events while shutdown flushes each shared sink once.

When an application separates diagnostics into multiple domain `Logger` channels that share `Arc` appenders, calling `flush()` on every `Logger` repeats flushes on each shared sink.

Add a runnable `multi_logger_pipeline` example demonstrating how subsystems emit records through channel handles (`Logger::noop()` before initialization) while the initialization boundary returns a `FlushGuard` over the unique `Vec<Arc<dyn Append>>` sink list so shutdown flushes each shared sink once.

Signed-off-by: tison <wander4096@gmail.com>
Add concise inline comments to `examples/src/multi_logger_pipeline.rs` explaining the pre-initialization `NOOP_LOGGERS` fallback, per-channel sink sharing, and single-pass `FlushGuard` drop behavior.

Signed-off-by: tison <wander4096@gmail.com>
@tisonkun
tisonkun merged commit b0180bd into main Dec 3, 2026
10 checks passed
@tisonkun
tisonkun deleted the docs/multi-logger-pipeline-example branch December 3, 2026 01:14
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.

1 participant