mirror of
https://github.com/Nanaloveyuki/BitLogger.git
synced 2026-07-24 00:42:18 +00:00
📝 clarify async builder layering docs
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
name: async-logger-build-config
|
||||
group: api
|
||||
category: async
|
||||
update-time: 20260613
|
||||
description: Create the combined sync-and-async build config used by async logger builder APIs.
|
||||
update-time: 20260614
|
||||
description: Create the combined sync-and-async build config used by async logger builder APIs, with the sync logger config applied before the outer async layer.
|
||||
key-word:
|
||||
- async
|
||||
- build
|
||||
@@ -26,7 +26,7 @@ pub fn AsyncLoggerBuildConfig::new(
|
||||
|
||||
#### input
|
||||
|
||||
- `logger : LoggerConfig` - Base synchronous logger config describing the sink, level, target, and related sync logger settings.
|
||||
- `logger : LoggerConfig` - Base synchronous logger config describing the sink, level, target, related sync logger settings, and any optional synchronous queue wrapper.
|
||||
- `async_config : AsyncLoggerConfig` - Async runtime config describing queue, batching, linger, and flush behavior.
|
||||
|
||||
#### output
|
||||
@@ -40,6 +40,7 @@ Detailed rules explaining key parameters and behaviors
|
||||
- Omitting `logger` uses `default_logger_config()`.
|
||||
- Omitting `async_config` uses `AsyncLoggerConfig::new()`.
|
||||
- The constructor simply packages both config objects into one public build shape.
|
||||
- When passed to `build_async_logger(...)`, the `logger` portion is built first through the normal synchronous config path before the outer async queue layer is applied.
|
||||
- This helper is the main code-side counterpart to `parse_async_logger_build_config_text(...)`.
|
||||
|
||||
### How to Use
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
name: build-async-logger
|
||||
group: api
|
||||
category: async
|
||||
update-time: 20260512
|
||||
description: Build an async logger from combined logger and async config without manually wiring the runtime sink.
|
||||
update-time: 20260614
|
||||
description: Build an async logger from combined logger and async config by first building the sync runtime logger and then wrapping its sink in the async layer.
|
||||
key-word:
|
||||
- async
|
||||
- config
|
||||
@@ -34,8 +34,9 @@ pub fn build_async_logger(config : AsyncLoggerBuildConfig) -> AsyncLogger[@bitlo
|
||||
Detailed rules explaining key parameters and behaviors
|
||||
|
||||
- The `logger` section is built through the same config machinery used by synchronous configured loggers.
|
||||
- That means `LoggerConfig.sink` and the optional synchronous `LoggerConfig.queue` are applied before the async layer is added.
|
||||
- The resulting async logger inherits `min_level`, `target`, and timestamp behavior from the built synchronous logger.
|
||||
- File, queue, and formatter choices all come from config rather than direct code-side sink wiring.
|
||||
- File, formatter, and any configured synchronous queue choices all come from config rather than direct code-side sink wiring.
|
||||
- The returned sink type is `RuntimeSink`, which keeps configured control helpers available where relevant.
|
||||
- The `src-async` library is designed to compile on `native / llvm / js / wasm / wasm-gc`, but runtime mode differs by backend.
|
||||
- Current local release-facing verification is explicit for `native / js / wasm / wasm-gc`.
|
||||
@@ -70,6 +71,8 @@ println(stringify_async_logger_state(logger.state(), pretty=true))
|
||||
|
||||
In this example, the built async logger remains introspectable even though construction was config-driven.
|
||||
|
||||
And any configured synchronous runtime sink controls are preserved inside the returned `RuntimeSink`.
|
||||
|
||||
### Error Case
|
||||
|
||||
e.g.:
|
||||
|
||||
Reference in New Issue
Block a user