aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/include/spdlog/cfg/env.h
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2022-08-24 00:32:31 +0100
committerGeckoEidechse <gecko.eidechse+git@pm.me>2022-08-25 21:32:55 +0200
commit46bed8d09f32360377350d71816a76abdfbf2c7c (patch)
tree7feedae4910dbfe0e53d26ea1e00c4616d2c1850 /NorthstarDLL/include/spdlog/cfg/env.h
parenta97f1f07bb5aa31629cd87023e09669eb4bf1fe9 (diff)
downloadNorthstarLauncher-46bed8d09f32360377350d71816a76abdfbf2c7c.tar.gz
NorthstarLauncher-46bed8d09f32360377350d71816a76abdfbf2c7c.zip
Adjust folder structure (#242)v1.9.5-rc1v1.9.5
* Adjust folder structure * change launcher directory name
Diffstat (limited to 'NorthstarDLL/include/spdlog/cfg/env.h')
-rw-r--r--NorthstarDLL/include/spdlog/cfg/env.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/NorthstarDLL/include/spdlog/cfg/env.h b/NorthstarDLL/include/spdlog/cfg/env.h
new file mode 100644
index 00000000..1f39ebbb
--- /dev/null
+++ b/NorthstarDLL/include/spdlog/cfg/env.h
@@ -0,0 +1,38 @@
+// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
+// Distributed under the MIT License (http://opensource.org/licenses/MIT)
+
+#pragma once
+#include <spdlog/cfg/helpers.h>
+#include <spdlog/details/registry.h>
+#include <spdlog/details/os.h>
+
+//
+// Init levels and patterns from env variables SPDLOG_LEVEL
+// Inspired from Rust's "env_logger" crate (https://crates.io/crates/env_logger).
+// Note - fallback to "info" level on unrecognized levels
+//
+// Examples:
+//
+// set global level to debug:
+// export SPDLOG_LEVEL=debug
+//
+// turn off all logging except for logger1:
+// export SPDLOG_LEVEL="*=off,logger1=debug"
+//
+
+// turn off all logging except for logger1 and logger2:
+// export SPDLOG_LEVEL="off,logger1=debug,logger2=info"
+
+namespace spdlog {
+namespace cfg {
+inline void load_env_levels()
+{
+ auto env_val = details::os::getenv("SPDLOG_LEVEL");
+ if (!env_val.empty())
+ {
+ helpers::load_levels(env_val);
+ }
+}
+
+} // namespace cfg
+} // namespace spdlog