tracing running only when enabled
This commit is contained in:
@@ -14,3 +14,7 @@ Client:
|
|||||||
cargo watch -x 'run --package client -- client'
|
cargo watch -x 'run --package client -- client'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Client with tracing:
|
||||||
|
```
|
||||||
|
ENABLE_TRACING=1 RUST_LOG=client=debug cargo watch -x 'run --package client -- client'
|
||||||
|
```
|
||||||
|
|||||||
@@ -3,10 +3,13 @@ use client::run_ui;
|
|||||||
use dotenvy::dotenv;
|
use dotenvy::dotenv;
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use tracing_subscriber;
|
use tracing_subscriber;
|
||||||
|
use std::env;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
|
if env::var("ENABLE_TRACING").is_ok() {
|
||||||
tracing_subscriber::fmt::init();
|
tracing_subscriber::fmt::init();
|
||||||
|
}
|
||||||
|
|
||||||
dotenv().ok();
|
dotenv().ok();
|
||||||
run_ui().await
|
run_ui().await
|
||||||
|
|||||||
Reference in New Issue
Block a user