-
-
Save sanbox-irl/65dcff347585960db9c5ad4e04b87411 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn initiate_logging() -> Result<(), Error> { | |
const LOG_LOCATION: &str = "build/build.log"; | |
let logfile = FileAppender::builder().build(LOG_LOCATION)?; | |
let config = Config::builder() | |
.appender(Appender::builder().build("logfile", Box::new(logfile))) | |
.build(Root::builder().appender("logfile") .build(LevelFilter::Info))?; | |
// Clear the log | |
fs::write(LOG_LOCATION, "")?; | |
log4rs::init_config(config)?; | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment