| |
}
|
| |
|
| |
fn execute() -> anyhow::Result<()> {
|
| - |
let home = profile::home()?;
|
| - |
let options = Options::from_env()?;
|
| - |
let config = options.config.unwrap_or_else(|| home.config());
|
| - |
let mut config = profile::Config::load(&config)?;
|
| - |
|
| - |
let level = options.log.unwrap_or_else(|| config.node.log.into());
|
| + |
// Before we do anything else, we choose a default log level and initialize
|
| + |
// logging. The simple reason is that the next thing we want to do is read
|
| + |
// configuration (which contains the actual log level to use), but note that
|
| + |
// *this might fail* in which case *the user expects a log output*.
|
| + |
let level = log::Level::Error;
|
| |
|
| |
let logger = {
|
| |
let journal = {
|
| |
log::set_boxed_logger(logger).expect("no other logger should have been set already");
|
| |
log::set_max_level(level.to_level_filter());
|
| |
|
| + |
let home = profile::home()?;
|
| + |
let options = Options::from_env()?;
|
| + |
let config = options.config.unwrap_or_else(|| home.config());
|
| + |
let mut config = profile::Config::load(&config)?;
|
| + |
|
| + |
let level = options.log.unwrap_or_else(|| config.node.log.into());
|
| + |
// Only now the log level obtained via configuration becomes active.
|
| + |
log::set_max_level(level.to_level_filter());
|
| + |
|
| |
log::info!(target: "node", "Starting node..");
|
| |
log::info!(target: "node", "Version {} ({})", env!("RADICLE_VERSION"), env!("GIT_HEAD"));
|
| |
log::info!(target: "node", "Unlocking node keystore..");
|