Skip to content

Commit d153bfa

Browse files
committed
Use log verbosity level from configration
Following #440 (comment).
1 parent 50d2242 commit d153bfa

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Diff for: server.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ shift
1010

1111
DB=./db2 # $HOME/tmp/electrs_db/mainnet_zstd
1212
CMD="target/release/electrs --network $NETWORK --db-dir $DB --daemon-dir $HOME/.bitcoin"
13-
export RUST_LOG=${RUST_LOG-info}
13+
# export RUST_LOG=${RUST_LOG-info}
1414
$CMD $*
1515

1616
# use SIGINT to quit

Diff for: src/config.rs

+7
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,12 @@ impl Config {
267267
}
268268
});
269269

270+
let level = match config.verbose {
271+
0 => log::LevelFilter::Info,
272+
1 => log::LevelFilter::Debug,
273+
_ => log::LevelFilter::Trace,
274+
};
275+
270276
let config = Config {
271277
network: config.network,
272278
db_path: config.db_dir,
@@ -286,6 +292,7 @@ impl Config {
286292
env_logger::Builder::from_default_env()
287293
.default_format()
288294
.format_timestamp_millis()
295+
.filter_level(level)
289296
.init();
290297
config
291298
}

0 commit comments

Comments
 (0)