Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Currently the `--debug` flag does not actually enable debug logging as intended. We initialize `env_logger` immediately in `main`, then attempt to change the log filtering level in `NewCli::run` if the `--debug` flag is passed. This does not work, as `env_logger::builder` needs its `init` method to be called to change the global logger. This is not an option, as we've already called `env_logger::init`. The internet suggests[0] that using `log::set_max_level` lets us change the level independently of logger initialization, but this did not work when I tried it out. Move logger initialization into `NewCli::run` so that we know the desired log level ahead of calling `init`. This means that items logged before we initialize the logger will be lost, but in practice we're not missing anything. [0] rust-cli/env_logger#228 (comment)
- Loading branch information