aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-06-10 10:50:56 +0000
committerGitHub <[email protected]>2021-06-10 10:50:56 +0000
commit0221b3a2201b1864a59ab058376bbaa1c2c07b74 (patch)
tree01343371e24c6d5309be87bd49572203bf6a351f
parentMerge pull request #42 from Whirlsplash/dependabot/npm_and_yarn/trim-newlines... (diff)
parentfix(whirl): logger definition (diff)
downloadwhirl-0221b3a2201b1864a59ab058376bbaa1c2c07b74.tar.xz
whirl-0221b3a2201b1864a59ab058376bbaa1c2c07b74.zip
Merge pull request #43 from Whirlsplash/renovate/flexi_logger-0.x
fix(deps): update rust crate flexi_logger to 0.18.0
-rw-r--r--crates/whirl/Cargo.toml2
-rw-r--r--crates/whirl/src/lib.rs11
2 files changed, 8 insertions, 5 deletions
diff --git a/crates/whirl/Cargo.toml b/crates/whirl/Cargo.toml
index 5abb1b5..ec89d90 100644
--- a/crates/whirl/Cargo.toml
+++ b/crates/whirl/Cargo.toml
@@ -19,7 +19,7 @@ dotenv = "0.15.0"
# Logging
log = "0.4.14"
-flexi_logger = "0.17.1"
+flexi_logger = "0.18.0"
human-panic = "1.0.3"
# simple-error = "0.2.3"
diff --git a/crates/whirl/src/lib.rs b/crates/whirl/src/lib.rs
index 494ba07..02de6e1 100644
--- a/crates/whirl/src/lib.rs
+++ b/crates/whirl/src/lib.rs
@@ -43,7 +43,10 @@ use whirl_config::Config;
pub struct Whirl;
impl Whirl {
/// # Errors
- /// - An error may arise if logger fails to start.
+ /// if the Logger fails to start.
+ ///
+ /// # Panics
+ /// if the Logger fails to be created.
pub async fn splash() -> Result<(), Box<dyn std::error::Error>> {
// Environment
std::env::set_var("DATABASE_URL", ".whirl/db.sqlite3");
@@ -52,7 +55,8 @@ impl Whirl {
dotenv::dotenv().ok();
human_panic::setup_panic!();
if Config::get().whirlsplash.log.enable {
- let logger = flexi_logger::Logger::with_str(whirl_common::log::calculate_log_level());
+ let logger =
+ flexi_logger::Logger::try_with_str(whirl_common::log::calculate_log_level()).unwrap();
if std::env::var("LOG_FILE").unwrap_or_else(|_| "true".to_string()) == "false"
|| !whirl_config::Config::get().whirlsplash.log.file
|| std::env::args().collect::<Vec<_>>()[1] == "clean"
@@ -62,8 +66,7 @@ impl Whirl {
} else {
logger
.print_message()
- .log_to_file()
- .directory(".whirl/log")
+ .log_to_file(flexi_logger::FileSpec::default().directory(".whirl/log"))
.start()?;
}
}