Logger-config-type
LoggerConfig is the public top-level serializable config type used to describe sync logger behavior. It is a direct alias to the logger config model used by config parsers, sync logger builders, and async build config embedding.
Interface
pub type LoggerConfig = @utils.LoggerConfigoutput
LoggerConfig- Public logger config object containingmin_level,target,timestamp,sink, and optionalqueue.
Explanation
Detailed rules explaining key parameters and behaviors
- This is a type alias, not a built logger instance.
- 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.