mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-28 00:00:20 +02:00
Replace set_var usage in examples (#829)
* examples: Fix inconsistent toml formatting * examples: Replace set_var usage
This commit is contained in:
@@ -8,7 +8,7 @@ publish = false
|
||||
axum = { path = "../../axum" }
|
||||
tokio = { version = "1.0", features = ["full"] }
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = { version="0.3", features = ["env-filter"] }
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
hyper = { version = "0.14", features = ["full"] }
|
||||
tower = { version = "0.4", features = ["util"] }
|
||||
futures = "0.3"
|
||||
|
||||
@@ -28,6 +28,7 @@ use tokio::{
|
||||
net::{unix::UCred, UnixListener, UnixStream},
|
||||
};
|
||||
use tower::BoxError;
|
||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||
|
||||
#[cfg(not(unix))]
|
||||
fn main() {
|
||||
@@ -37,11 +38,12 @@ fn main() {
|
||||
#[cfg(unix)]
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
// Set the RUST_LOG, if it hasn't been explicitly defined
|
||||
if std::env::var_os("RUST_LOG").is_none() {
|
||||
std::env::set_var("RUST_LOG", "debug")
|
||||
}
|
||||
tracing_subscriber::fmt::init();
|
||||
tracing_subscriber::registry()
|
||||
.with(tracing_subscriber::EnvFilter::new(
|
||||
std::env::var("RUST_LOG").unwrap_or_else(|_| "debug".into()),
|
||||
))
|
||||
.with(tracing_subscriber::fmt::layer())
|
||||
.init();
|
||||
|
||||
let path = PathBuf::from("/tmp/axum/helloworld");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user