2.5 KiB
name, group, category, update-time, description, key-word
| name | group | category | update-time | description | key-word | ||||
|---|---|---|---|---|---|---|---|---|---|
| logger-config-type | api | config | 20260707 | Public logger config type re-exported from config_model for serializable top-level sync settings. |
|
Logger-config-type
LoggerConfig is the public top-level serializable config type used to describe sync logger behavior. On the root src facade, it is re-exported from src/config_model, which is the real owner of the concrete logger config model.
Interface
pub using @config_model { type LoggerConfig }
output
LoggerConfig- Public logger config object containingmin_level,target,timestamp,sink, and optionalqueue.
Explanation
Detailed rules explaining key parameters and behaviors
- This root surface is a re-export, not the concrete owner definition.
- The concrete type lives in
@config_model.LoggerConfig, not in@utils. - The current fields are
min_level : Level,target : String,timestamp : Bool,sink : SinkConfig, andqueue : QueueConfig?. LoggerConfig::new(...)constructs this type as the main sync config entry point.parse_logger_config_text(...),logger_config_to_json(...),stringify_logger_config(...), andbuild_logger(...)all consume or produce the same public config shape.
How to Use
Here are some specific examples provided.
When Need A Typed Top-level Logger Policy
When sync logger settings should remain structured config data before runtime construction:
let config : LoggerConfig = LoggerConfig::new(target="svc")
In this example, the logger setup stays as a typed config object instead of becoming a runtime logger immediately.
When Need To Inspect Or Export Full Sync Logger Settings
When configuration should be reviewed or serialized before build time:
let config = LoggerConfig::new(queue=Some(QueueConfig::new(16)))
println(stringify_logger_config(config, pretty=true))
In this example, the same public config type supports both inspection and later runtime assembly.
Error Case
e.g.:
-
LoggerConfigitself does not have a runtime failure mode. -
A valid config object can still describe a sink shape whose eventual runtime behavior depends on backend support, such as file output on limited targets.
Notes
-
Use
LoggerConfig::new(...)when you need a value of this type in code. -
Use
ConfiguredLoggerorLoggeronly after a build step when runtime logging behavior is actually needed.