Expand description
Layered configuration and structured logging for Rust services.
Two halves behind one crate:
config— stack configuration from files, environment variables and Azure App Configuration, merge by declared precedence, read typed values. Always available.logging— a non-blockingtracingfacade with console, JSON, file and syslog sinks, per-sink filters, runtime reload, and optional Azure Application Insights export. Behind theloggingfeature, so a config-only user compiles none of it.
The two meet in one direction only: logging can be described in
configuration (logging::settings::Settings reads a [logging] block
from a config::Store), and init stands both up in a single call.
The config half never depends on the logging half.
use stratify::config;
let store = config::Builder::default()
.json("config/base.json", 100)
.yaml("config/override.yaml", 50)
.env("APP_", "__", 10)
.build()
.await?;
let host = store.get_str("database.host");§Feature flags
azure—config::source::AzureAppConfigSource, reading from Azure App Configuration. Off by default, because it brings in an HTTP stack that a file-and-environment user should not pay for.logging— theloggingmodule andinit.compression— gzip retired log files (implieslogging).appinsights— export to Azure Application Insights with trace correlation (implieslogging).
Modules§
- config
- Layered configuration: pluggable sources, priority merging, typed access. Layered configuration: pluggable sources, priority merging, typed access.
- logging
- Structured logging: a non-blocking
tracingfacade with pluggable sinks.
Macros§
- file_
source - Macro to generate a file-based configuration source.
Structs§
- Bootstrap
- What
inithands back: the configuration everything else reads, and the handle that keeps the logging workers alive. - Options
- How
init_withbuilds the stack.Options::newgives the conventional setup; every field is overridable from there.
Enums§
- Init
Error - Everything that can go wrong before the first log line.