Photon
1.0.0
Loading...
Searching...
No Matches
env.h
Go to the documentation of this file.
1
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
3
4
#pragma once
5
#include <
spdlog/cfg/helpers.h
>
6
#include <
spdlog/details/registry.h
>
7
#include <
spdlog/details/os.h
>
8
9
//
10
// Init levels and patterns from env variables SPDLOG_LEVEL
11
// Inspired from Rust's "env_logger" crate (https://crates.io/crates/env_logger).
12
// Note - fallback to "info" level on unrecognized levels
13
//
14
// Examples:
15
//
16
// set global level to debug:
17
// export SPDLOG_LEVEL=debug
18
//
19
// turn off all logging except for logger1:
20
// export SPDLOG_LEVEL="*=off,logger1=debug"
21
//
22
23
// turn off all logging except for logger1 and logger2:
24
// export SPDLOG_LEVEL="off,logger1=debug,logger2=info"
25
26
namespace
spdlog
27
{
28
namespace
cfg
29
{
30
inline
void
load_env_levels
()
31
{
32
auto
env_val =
details::os::getenv
(
"SPDLOG_LEVEL"
);
33
if
(!env_val.empty())
34
{
35
helpers::load_levels
(env_val);
36
}
37
}
38
39
}
// namespace cfg
40
}
// namespace spdlog
os.h
helpers.h
spdlog::cfg::helpers::load_levels
SPDLOG_INLINE void load_levels(const std::string &input)
Definition
helpers-inl.h:85
spdlog::cfg::load_env_levels
void load_env_levels()
Definition
env.h:30
spdlog::details::os::getenv
std::string SPDLOG_INLINE getenv(const char *field)
Definition
os-inl.h:587
spdlog
Definition
async.h:26
registry.h
vendor
spdlog
cfg
env.h
Generated by
1.9.8