mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-11-26 00:24:55 +01:00
16 lines
508 B
Rust
16 lines
508 B
Rust
|
use tracing_subscriber::{EnvFilter, fmt};
|
||
|
use crate::Config;
|
||
|
|
||
|
pub fn init(config: &Config) {
|
||
|
let mut builder = tracing_subscriber::fmt()
|
||
|
.with_env_filter(EnvFilter::from_default_env());
|
||
|
let format = config.log_format.to_lowercase();
|
||
|
match format.as_str() {
|
||
|
"compact" => builder.compact().init(),
|
||
|
"pretty" => builder.pretty().init(),
|
||
|
"full" => builder.init(),
|
||
|
_ => builder.init(),
|
||
|
}
|
||
|
|
||
|
tracing::info!(format = format.as_str(), "Logging initialized")
|
||
|
}
|