1
0
mirror of https://github.com/romanz/electrs.git synced 2024-11-19 09:54:09 +01:00

Use log verbosity level from configration

Following https://github.com/romanz/electrs/issues/440#issuecomment-886094765.
This commit is contained in:
Roman Zeyde 2021-07-27 20:51:32 +03:00
parent 50d22425bb
commit d153bfa2eb
2 changed files with 8 additions and 1 deletions

View File

@ -10,7 +10,7 @@ shift
DB=./db2 # $HOME/tmp/electrs_db/mainnet_zstd
CMD="target/release/electrs --network $NETWORK --db-dir $DB --daemon-dir $HOME/.bitcoin"
export RUST_LOG=${RUST_LOG-info}
# export RUST_LOG=${RUST_LOG-info}
$CMD $*
# use SIGINT to quit

View File

@ -267,6 +267,12 @@ impl Config {
}
});
let level = match config.verbose {
0 => log::LevelFilter::Info,
1 => log::LevelFilter::Debug,
_ => log::LevelFilter::Trace,
};
let config = Config {
network: config.network,
db_path: config.db_dir,
@ -286,6 +292,7 @@ impl Config {
env_logger::Builder::from_default_env()
.default_format()
.format_timestamp_millis()
.filter_level(level)
.init();
config
}