📝 clarify application async alias behavior

This commit is contained in:
Nanaloveyuki
2026-06-14 07:46:24 +08:00
parent 97feb57cd7
commit 98e514821f
4 changed files with 21 additions and 5 deletions
@@ -40,6 +40,7 @@ Detailed rules explaining key parameters and behaviors
- Any optional synchronous queue layer and runtime-sink controls chosen by `build_logger(config.logger)` remain active under the returned logger.
- In particular, a sync queue configured on `LoggerConfig.queue` is preserved inside the wrapped `RuntimeSink` variant instead of being stripped away by the application alias.
- Because the result is only the `ApplicationAsyncLogger` alias over `AsyncLogger[@bitlogger.RuntimeSink]`, this builder does not hide any async helpers or introduce a wrapper layer.
- The returned alias also keeps inherited async logger target behavior such as `with_target(...)`, `child(...)`, and per-call `target=` overrides on `log(...)`.
- The returned logger keeps the full async lifecycle and state helper surface directly, including helpers such as `run()`, `shutdown()`, `pending_count()`, `dropped_count()`, `state()`, `wait_idle()`, `has_failed()`, and `last_error()`.
- It also keeps the same queue counters, failure state, sink shape, and runtime-dependent post-close behavior as the underlying runtime-sink async logger.
- In the current direct builder coverage, this alias matches `build_async_logger(config)` all the way through serialized state snapshots, runtime-sink variant choice, queue counters, lifecycle flags, and later failure fields after `run()` or `shutdown()`.
@@ -66,6 +67,8 @@ In this example, the app-facing async facade is built directly from typed config
And any configured synchronous runtime sink controls remain available through the returned `RuntimeSink`-backed async logger.
The returned value also keeps the ordinary async logger target semantics because the facade does not wrap or narrow the underlying `AsyncLogger[@bitlogger.RuntimeSink]`.
#### When Need Async State Helpers Immediately After App Construction
When application code should keep the ordinary async helper surface directly: