📝 clarify async text builder docs

This commit is contained in:
Nanaloveyuki
2026-06-14 00:06:05 +08:00
parent 4b5456f646
commit 8196fe27b6
3 changed files with 12 additions and 9 deletions
@@ -2,8 +2,8 @@
name: build-application-text-async-logger
group: api
category: facade
update-time: 20260520
description: Build the application-facing text-console async logger facade from an AsyncLoggerBuildConfig.
update-time: 20260614
description: Build the application-facing text-console async logger facade from an AsyncLoggerBuildConfig using the configured text formatter directly.
key-word:
- application
- async
@@ -37,6 +37,7 @@ 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.
- The returned logger keeps the usual async lifecycle helpers.
### How to Use
@@ -60,7 +61,7 @@ In this example, the async logger is built for text-console output specifically.
### Error Case
e.g.:
- If the embedded logger config selects a non-text sink shape, the caller should use the general async builder facade instead.
- If callers need sink-kind-driven branching such as JSON console or file-backed async output, they should use `build_application_async_logger(...)` instead.
- If runtime draining is never started, records still follow the normal async queue lifecycle rules.
+4 -3
View File
@@ -2,8 +2,8 @@
name: build-async-text-logger
group: api
category: async
update-time: 20260520
description: Build an async logger with a concrete text-console sink from combined logger and async config.
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.
key-word:
- async
- text
@@ -34,6 +34,7 @@ pub fn build_async_text_logger(config : AsyncLoggerBuildConfig) -> AsyncLogger[@
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`.
- 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.
@@ -59,7 +60,7 @@ In this example, the async logger is built around a text console sink rather tha
### Error Case
e.g.:
- If the logger config was not intended for text-console style output, the broader `build_async_logger(...)` path may be a better fit.
- If callers need sink-kind-driven branching across console, JSON, text, or file output, `build_async_logger(...)` is the better fit.
- If the logger is never `run()`, pending records still follow the normal async queue lifecycle rules.
+4 -3
View File
@@ -2,8 +2,8 @@
name: build-library-async-text-logger
group: api
category: facade
update-time: 20260520
description: Build the library-facing text-console async logger facade from an AsyncLoggerBuildConfig.
update-time: 20260614
description: Build the library-facing text-console async logger facade from an AsyncLoggerBuildConfig using the configured text formatter directly.
key-word:
- library
- async
@@ -36,6 +36,7 @@ pub fn build_library_async_text_logger(
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.
- 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.
@@ -60,7 +61,7 @@ In this example, the async text sink shape is preserved under the library facade
### Error Case
e.g.:
- If the embedded logger config does not describe text-console output, the caller should use the broader async facade instead.
- If callers need sink-kind-driven branching such as JSON console or file-backed async output, they should use `build_library_async_logger(...)` instead.
- Normal async lifecycle expectations still apply if the logger is never run.