From ca5db71e8215a6c5660fe03088a6d7349f55f817 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Sat, 17 Jul 2021 22:33:00 +0100 Subject: add support for custom convars and concommands --- NorthstarDedicatedTest/include/spdlog/cfg/env.h | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 NorthstarDedicatedTest/include/spdlog/cfg/env.h (limited to 'NorthstarDedicatedTest/include/spdlog/cfg/env.h') diff --git a/NorthstarDedicatedTest/include/spdlog/cfg/env.h b/NorthstarDedicatedTest/include/spdlog/cfg/env.h new file mode 100644 index 00000000..1f39ebbb --- /dev/null +++ b/NorthstarDedicatedTest/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 +#include +#include + +// +// 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 -- cgit v1.2.3