mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-28 09:09:35 +08:00
Support custom environment variables for load_env_levels (#3327)
SPDLOG_LEVEL is currently supported to control log levels via load_env_levels. This patch adds support for other environment variable names, such as MYAPP_LEVEL, for load_env_levels.
This commit is contained in:
@@ -148,6 +148,9 @@ void load_levels_example() {
|
||||
// Set the log level to "info" and mylogger to "trace":
|
||||
// SPDLOG_LEVEL=info,mylogger=trace && ./example
|
||||
spdlog::cfg::load_env_levels();
|
||||
// or specify the env variable name:
|
||||
// MYAPP_LEVEL=info,mylogger=trace && ./example
|
||||
// spdlog::cfg::load_env_levels("MYAPP_LEVEL");
|
||||
// or from command line:
|
||||
// ./example SPDLOG_LEVEL=info,mylogger=trace
|
||||
// #include "spdlog/cfg/argv.h" // for loading levels from argv
|
||||
|
Reference in New Issue
Block a user