Set RUST_LOG environment var for all examples using tracing (#123)

* Set RUST_LOG environment var for all examples using tracing

Signed-off-by: Spencer Gilbert <[email protected]>

* Update examples/multipart_form.rs

Co-authored-by: David Pedersen <[email protected]>
This commit is contained in:
Spencer Gilbert
2021-08-05 11:25:03 +02:00
committed by GitHub
co-authored by David Pedersen
parent a8eb26b672
commit 3cd0c0fd45
17 changed files with 120 additions and 18 deletions
+8 -2
View File
@@ -3,7 +3,7 @@
//! Run with
//!
//! ```not_rust
//! RUST_LOG=tower_http=debug,key_value_store=trace cargo run --features=ws,headers --example websocket
//! cargo run --features=ws,headers --example websocket
//! ```
use axum::{
@@ -22,7 +22,13 @@ use tower_http::{
#[tokio::main]
async fn main() {
tracing_subscriber::fmt::init();
// Set the RUST_LOG, if it hasn't been explicitly defined
if std::env::var("RUST_LOG").is_err() {
std::env::set_var("RUST_LOG", "websocket=debug,tower_http=debug")
}
tracing_subscriber::fmt::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init();
// build our application with some routes
let app = nest(