Agora
1.2.0
Agora project
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
namespace
cfg {
28
inline
void
load_env_levels
()
29
{
30
auto
env_val =
details::os::getenv
(
"SPDLOG_LEVEL"
);
31
if
(!env_val.empty())
32
{
33
helpers::load_levels
(env_val);
34
}
35
}
36
37
}
// namespace cfg
38
}
// namespace spdlog
spdlog
Definition:
async.h:25
os.h
helpers.h
spdlog::details::os::getenv
std::string SPDLOG_INLINE getenv(const char *field)
Definition:
os-inl.h:590
registry.h
spdlog::cfg::load_env_levels
void load_env_levels()
Definition:
env.h:28
spdlog::cfg::helpers::load_levels
SPDLOG_INLINE void load_levels(const std::string &input)
Definition:
helpers-inl.h:82
third_party
spdlog
include
spdlog
cfg
env.h
Generated by
1.8.17