diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-04-09 20:13:12 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-04-09 20:13:12 +0300 |
commit | f3ed6ba027dbb410161970c4a706192885d92a3d (patch) | |
tree | 9b21a20e72eee78963f0099cf9c296d7f307313e /src | |
parent | a7bbd6d91139093b488c9ac4b543f24ede23a495 (diff) | |
download | obnam2-f3ed6ba027dbb410161970c4a706192885d92a3d.tar.gz |
refactor: move function to better place
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/obnam.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/bin/obnam.rs b/src/bin/obnam.rs index 2dbbaa2..bb0cbdb 100644 --- a/src/bin/obnam.rs +++ b/src/bin/obnam.rs @@ -53,6 +53,19 @@ fn main() -> anyhow::Result<()> { Ok(()) } +fn setup_logging(filename: &Path) -> anyhow::Result<()> { + let logfile = FileAppender::builder().build(filename)?; + + let config = Config::builder() + .appender(Appender::builder().build("obnam", Box::new(logfile))) + .logger(Logger::builder().build("obnam", LevelFilter::Debug)) + .build(Root::builder().appender("obnam").build(LevelFilter::Debug))?; + + log4rs::init_config(config)?; + + Ok(()) +} + fn load_config_with_passwords(opt: &Opt) -> Result<ClientConfig, anyhow::Error> { Ok(ClientConfig::read_with_passwords(&config_filename(opt))?) } @@ -115,16 +128,3 @@ enum Command { }, Config, } - -fn setup_logging(filename: &Path) -> anyhow::Result<()> { - let logfile = FileAppender::builder().build(filename)?; - - let config = Config::builder() - .appender(Appender::builder().build("obnam", Box::new(logfile))) - .logger(Logger::builder().build("obnam", LevelFilter::Debug)) - .build(Root::builder().appender("obnam").build(LevelFilter::Debug))?; - - log4rs::init_config(config)?; - - Ok(()) -} |