aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-15 16:32:39 +0000
committerFuwn <[email protected]>2021-05-15 16:32:39 +0000
commit4389bd9d3661a6a0e45d50c54f6489bb8f24851b (patch)
tree4ae88aacc461fac21226392a871a9bd56e9c1b03 /src/utils
parentfeat(global): logs now go to a dedicated directory and file (diff)
downloadwhirl-4389bd9d3661a6a0e45d50c54f6489bb8f24851b.tar.xz
whirl-4389bd9d3661a6a0e45d50c54f6489bb8f24851b.zip
feat(config): better logging configuration
Logging is very much imporved in just about every aspect. BREAKING CHANGE: `whirlsplash.log` configuration group created, `whirlsplash.log_level` configuration key removed.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/log.rs19
-rw-r--r--src/utils/mod.rs1
2 files changed, 20 insertions, 0 deletions
diff --git a/src/utils/log.rs b/src/utils/log.rs
new file mode 100644
index 0000000..e4a45e9
--- /dev/null
+++ b/src/utils/log.rs
@@ -0,0 +1,19 @@
+// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
+// SPDX-License-Identifier: GPL-3.0-only
+
+use crate::config::Config;
+
+pub fn calculate_log_level() -> String {
+ let mut level;
+
+ level = match Config::get().whirlsplash.log.level {
+ 2 => "debug".to_string(),
+ 3 => "trace".to_string(),
+ _ => "info".to_string(),
+ };
+ if !Config::get().whirlsplash.log.everything {
+ level = format!("whirl={}", level);
+ }
+
+ level
+}
diff --git a/src/utils/mod.rs b/src/utils/mod.rs
index 69c91d1..f5069fc 100644
--- a/src/utils/mod.rs
+++ b/src/utils/mod.rs
@@ -1,4 +1,5 @@
// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
// SPDX-License-Identifier: GPL-3.0-only
+pub mod log;
pub mod system;