mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-17 02:38:18 -07:00
Stop using set_env to configure tracing-subscriber
This commit is contained in:
parent
abb4b4cf0b
commit
ce60fc6859
@ -184,9 +184,6 @@ fn setup_rocket(config: Figment, data: Arc<RwLock<Database>>) -> rocket::Rocket<
|
||||
|
||||
#[rocket::main]
|
||||
async fn main() {
|
||||
// Force log level off, so we can use our own logger
|
||||
std::env::set_var("CONDUIT_LOG_LEVEL", "off");
|
||||
|
||||
let raw_config =
|
||||
Figment::from(default_config())
|
||||
.merge(
|
||||
@ -197,8 +194,6 @@ async fn main() {
|
||||
)
|
||||
.merge(Env::prefixed("CONDUIT_").global());
|
||||
|
||||
std::env::set_var("RUST_LOG", "warn");
|
||||
|
||||
let config = match raw_config.extract::<Config>() {
|
||||
Ok(s) => s,
|
||||
Err(e) => {
|
||||
@ -244,8 +239,6 @@ async fn main() {
|
||||
println!("exporting");
|
||||
opentelemetry::global::shutdown_tracer_provider();
|
||||
} else {
|
||||
std::env::set_var("RUST_LOG", &config.log);
|
||||
|
||||
let registry = tracing_subscriber::Registry::default();
|
||||
if config.tracing_flame {
|
||||
let (flame_layer, _guard) =
|
||||
@ -259,7 +252,7 @@ async fn main() {
|
||||
start.await;
|
||||
} else {
|
||||
let fmt_layer = tracing_subscriber::fmt::Layer::new();
|
||||
let filter_layer = EnvFilter::try_from_default_env()
|
||||
let filter_layer = EnvFilter::try_new(&config.log)
|
||||
.or_else(|_| EnvFilter::try_new("info"))
|
||||
.unwrap();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user