📝 clarify async text builder path

This commit is contained in:
Nanaloveyuki
2026-06-14 00:23:06 +08:00
parent 77d97cef5e
commit d748bfc6e6
3 changed files with 7 additions and 1 deletions
@@ -38,6 +38,8 @@ Detailed rules explaining key parameters and behaviors
- This API delegates to `build_async_text_logger(...)`.
- It is intended for config-driven async text console output where callers want the concrete text sink shape rather than the broader runtime sink enum wrapper.
- The builder always creates a `FormattedConsoleSink` from `config.logger.sink.text_formatter` instead of selecting among sink kinds.
- Unlike `build_application_async_logger(...)`, this facade does not go through the full synchronous configured-logger build path first.
- It uses the selected text-oriented `LoggerConfig` fields directly and therefore does not apply `LoggerConfig.queue` or preserve sync runtime sink controls.
- The returned logger keeps the usual async lifecycle helpers.
### How to Use
+3 -1
View File
@@ -3,7 +3,7 @@ name: build-async-text-logger
group: api
category: async
update-time: 20260614
description: Build an async logger with a concrete text-console sink from combined logger and async config, always using the configured text formatter.
description: Build an async logger with a concrete text-console sink from combined logger and async config, using only the selected text-oriented LoggerConfig fields instead of the full sync build path.
key-word:
- async
- text
@@ -36,6 +36,8 @@ Detailed rules explaining key parameters and behaviors
- This builder converts `config.logger.sink.text_formatter` into a runtime `TextFormatter` and wires it into `text_console_sink(...)`.
- It always constructs a `FormattedConsoleSink` directly instead of branching on `config.logger.sink.kind`.
- The returned logger inherits `min_level`, `target`, and timestamp behavior from `config.logger`.
- Unlike `build_async_logger(...)`, this helper does not run the full synchronous `build_logger(config.logger)` path first.
- That means it uses `config.logger.sink.text_formatter`, `min_level`, `target`, and `timestamp` directly, but it does not apply `LoggerConfig.queue` or preserve other sync runtime sink controls.
- This helper is best suited to text-console output paths where callers want the concrete formatted sink type instead of `RuntimeSink`.
- This async text path follows the same target story as the broader async library: `native / js / wasm / wasm-gc` have stronger local verification, while `llvm` remains experimental and locally unverified in this environment.
@@ -37,6 +37,8 @@ Detailed rules explaining key parameters and behaviors
- This API delegates to `build_async_text_logger(...)` and then wraps the result as `LibraryAsyncLogger`.
- It always produces a concrete `FormattedConsoleSink` from `config.logger.sink.text_formatter` instead of selecting among sink kinds.
- Unlike `build_library_async_logger(...)`, this facade does not go through the full synchronous configured-logger build path first.
- It uses the selected text-oriented `LoggerConfig` fields directly and therefore does not apply `LoggerConfig.queue` or preserve sync runtime sink controls.
- It is useful when library code wants a narrow async facade while preserving a concrete text-console sink type.
- `to_async_logger()` can recover the underlying full async logger if needed.