Skip to content

Commit

Permalink
🪵 Allow using RUST_LOG to configure logging level at run time
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiBardon committed May 29, 2024
1 parent 91eec00 commit b0cf4ee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ serde_json = "1"
thiserror = "1"
time = "0.3"
tracing = "0.1"
tracing-subscriber = "0.3"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
rocket = "0.5"
iso8601-duration = "0.2"
5 changes: 2 additions & 3 deletions src/orangutan-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ use rocket::{
Request,
};
use routes::{main_route, update_content_routes};
use tracing::Level;
use tracing_subscriber::FmtSubscriber;
use tracing_subscriber::{EnvFilter, FmtSubscriber};
use util::error;

use crate::config::NOT_FOUND_FILE;
Expand All @@ -33,7 +32,7 @@ fn rocket() -> _ {
.attach(AdHoc::on_liftoff("Tracing subsciber", |_| {
Box::pin(async move {
let subscriber = FmtSubscriber::builder()
.with_max_level(Level::TRACE)
.with_env_filter(EnvFilter::from_default_env())
.finish();
tracing::subscriber::set_global_default(subscriber)
.expect("Failed to set tracing subscriber.");
Expand Down

0 comments on commit b0cf4ee

Please sign in to comment.