Skip to content

Multiple loggers having an empty string as name, OK? #2639

Answered by tt4g
N-Dekker asked this question in Q&A
Discussion options

You must be logged in to vote

default_logger uses an empty string for its name.

#ifndef SPDLOG_DISABLE_DEFAULT_LOGGER
// create default logger (ansicolor_stdout_sink_mt or wincolor_stdout_sink_mt in windows).
# ifdef _WIN32
auto color_sink = std::make_shared<sinks::wincolor_stdout_sink_mt>();
# else
auto color_sink = std::make_shared<sinks::ansicolor_stdout_sink_mt>();
# endif
const char *default_logger_name = "";
default_logger_ = std::make_shared<spdlog::logger>(default_logger_name, std::move(color_sink));
loggers_[default_logger_name] = default_logger_;
#endif // SPDLOG_DISA…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@N-Dekker
Comment options

Answer selected by N-Dekker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants