aboutsummaryrefslogtreecommitdiff
path: root/crates/whirl_common/src/log.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/whirl_common/src/log.rs')
-rw-r--r--crates/whirl_common/src/log.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/whirl_common/src/log.rs b/crates/whirl_common/src/log.rs
new file mode 100644
index 0000000..39ceca0
--- /dev/null
+++ b/crates/whirl_common/src/log.rs
@@ -0,0 +1,19 @@
+// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
+// SPDX-License-Identifier: GPL-3.0-only
+
+use whirl_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
+}