2.6 KiB
name, group, category, update-time, description, key-word
| name | group | category | update-time | description | key-word | ||||
|---|---|---|---|---|---|---|---|---|---|
| async-logger-config-type | api | async | 20260613 | Public async logger config alias used for queue, batching, linger, and flush settings. |
|
Async-logger-config-type
AsyncLoggerConfig is the public config object used to describe async queue capacity, overflow behavior, batching, linger timing, and flush policy. It is a direct alias to the async config model used by async_logger(...), config parsers, and async config serializers.
Interface
pub type AsyncLoggerConfig = @utils.AsyncLoggerConfig
output
AsyncLoggerConfig- Public async config object containingmax_pending,overflow,max_batch,linger_ms, andflush.
Explanation
Detailed rules explaining key parameters and behaviors
- This is a type alias, not a runtime logger handle.
- The current fields are
max_pending : Int,overflow : AsyncOverflowPolicy,max_batch : Int,linger_ms : Int, andflush : AsyncFlushPolicy. AsyncLoggerConfig::new(...)constructs this type with the same normalization rules used by the runtime.parse_async_logger_config_text(...),async_logger_config_to_json(...), andstringify_async_logger_config(...)all operate on this same public config shape.
How to Use
Here are some specific examples provided.
When Need A Typed Async Runtime Policy Value
When async queue and flush behavior should be passed around as structured config:
let config : AsyncLoggerConfig = AsyncLoggerConfig::new(
max_pending=64,
overflow=AsyncOverflowPolicy::DropOldest,
)
In this example, async policy remains a typed object instead of immediately becoming JSON text or a logger instance.
When Need To Inspect The Config Before Building
When one layer should read or adjust async policy before logger construction:
let config = AsyncLoggerConfig::new(max_batch=4, linger_ms=20)
println(stringify_async_logger_config(config, pretty=true))
In this example, the same public config object supports both inspection and later build steps.
Error Case
e.g.:
-
AsyncLoggerConfigitself does not have a runtime failure mode. -
Constructor normalization still applies when the value is created through
AsyncLoggerConfig::new(...), so very small or negative timing and batch inputs may be adjusted before later serialization or use.
Notes
-
Use
AsyncLoggerConfig::new(...)when you need a value of this type in code. -
Use
AsyncLoggerBuildConfigwhen the async config should travel together with the base synchronousLoggerConfig.