aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
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;