Sink-kind
SinkKind is the public enum that selects which built-in sink shape a SinkConfig should build. On the root src facade, it is re-exported from src/config_model, so config builders, JSON parsers, and sink serialization helpers all use the same small set of variants.
Interface
pub using @config_model { type SinkKind }output
SinkKind- Public sink selection enum with the variantsConsole,JsonConsole,TextConsole, andFile.
Explanation
Detailed rules explaining key parameters and behaviors
- This root surface is a re-export, not the concrete owner definition.
- The concrete enum lives in
@config_model.SinkKind, not in@utils. SinkKind::Consoleselects the basic text console sink.SinkKind::JsonConsoleselects JSON line output.SinkKind::TextConsoleselects text console output driven byTextFormatterConfig.SinkKind::Fileselects file-backed output and requires a non-emptypathduring config parsing.
How to Use
Here are some specific examples provided.
When Need To Build A File Sink Through Config
When logger construction should be described entirely as config data:
let sink = SinkConfig::new(kind=SinkKind::File, path="app.log")
let config = LoggerConfig::new(sink=sink)In this example, the selected enum variant controls which built-in sink builder will be used.
When Need Formatter-driven Console Output
When the config should request text console formatting instead of the default console sink:
let sink = SinkConfig::new(kind=SinkKind::TextConsole)In this example, the enum value makes the config intent explicit.
Error Case
e.g.:
Unsupported sink kind text in parsed JSON raises
ConfigError.SinkKind::Filewithout a non-emptypathis rejected during config parsing.
Notes
This enum is for config-driven sink selection, not for direct handwritten sink composition.
Use concrete constructors such as
console_sink()orfile_sink(...)when building sinks in code instead of throughSinkConfig.