|
||||
File indexing completed on 2025-01-18 10:12:40
0001 // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. 0002 // Distributed under the MIT License (http://opensource.org/licenses/MIT) 0003 0004 #pragma once 0005 #include <spdlog/cfg/helpers.h> 0006 #include <spdlog/details/registry.h> 0007 #include <spdlog/details/os.h> 0008 0009 // 0010 // Init levels and patterns from env variables SPDLOG_LEVEL 0011 // Inspired from Rust's "env_logger" crate (https://crates.io/crates/env_logger). 0012 // Note - fallback to "info" level on unrecognized levels 0013 // 0014 // Examples: 0015 // 0016 // set global level to debug: 0017 // export SPDLOG_LEVEL=debug 0018 // 0019 // turn off all logging except for logger1: 0020 // export SPDLOG_LEVEL="*=off,logger1=debug" 0021 // 0022 0023 // turn off all logging except for logger1 and logger2: 0024 // export SPDLOG_LEVEL="off,logger1=debug,logger2=info" 0025 0026 namespace spdlog { 0027 namespace cfg { 0028 inline void load_env_levels() 0029 { 0030 auto env_val = details::os::getenv("SPDLOG_LEVEL"); 0031 if (!env_val.empty()) 0032 { 0033 helpers::load_levels(env_val); 0034 } 0035 } 0036 0037 } // namespace cfg 0038 } // namespace spdlog
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |