Skip to content

Commit b6d472d

Browse files
authored
feat(ipc-cli): enable logging from imported libraries (#890)
1 parent 0034326 commit b6d472d

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ipc/cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ ipc-wallet = { workspace = true }
4646
ipc-provider = { workspace = true }
4747
ipc-api = { workspace = true }
4848
ipc-types = { workspace = true }
49+
tracing-subscriber.workspace = true

ipc/cli/src/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
// Copyright 2022-2024 Protocol Labs
22
// SPDX-License-Identifier: MIT
33

4+
use tracing_subscriber::prelude::*;
5+
use tracing_subscriber::{fmt, EnvFilter};
6+
47
#[tokio::main]
58
async fn main() {
6-
env_logger::init_from_env(env_logger::Env::new().default_filter_or("info"));
9+
tracing_subscriber::registry()
10+
.with(fmt::layer())
11+
.with(EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")))
12+
.init();
713

814
if let Err(e) = ipc_cli::cli().await {
915
log::error!("main process failed: {e:#}");

0 commit comments

Comments
 (0)