diff --git a/example/example.cpp b/example/example.cpp index 006fc2fe..df89ae56 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -28,7 +28,6 @@ void clone_example(); int main(int, char *[]) { - spdlog::info("Welcome to spdlog version {}.{}.{} !", SPDLOG_VER_MAJOR, SPDLOG_VER_MINOR, SPDLOG_VER_PATCH); spdlog::warn("Easy padding in numbers like {:08d}", 12); spdlog::critical("Support for int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}", 42); diff --git a/include/spdlog/details/registry.h b/include/spdlog/details/registry.h index 9896d6f3..053ac923 100644 --- a/include/spdlog/details/registry.h +++ b/include/spdlog/details/registry.h @@ -215,15 +215,20 @@ private: registry() : formatter_(new pattern_formatter("%+")) { - // create default logger (stdout_color_mt). + +#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(); #else auto color_sink = std::make_shared(); #endif - SPDLOG_CONSTEXPR const char *default_logger_name = ""; + + const char *default_logger_name = ""; default_logger_ = std::make_shared(default_logger_name, std::move(color_sink)); loggers_[default_logger_name] = default_logger_; + +#endif // SPDLOG_DISABLE_DEFAULT_LOGGER } ~registry() = default; diff --git a/include/spdlog/tweakme.h b/include/spdlog/tweakme.h index dfadd567..d0ec1b93 100644 --- a/include/spdlog/tweakme.h +++ b/include/spdlog/tweakme.h @@ -121,3 +121,11 @@ // #define SPDLOG_LEVEL_NAMES { "MY TRACE", "MY DEBUG", "MY INFO", "MY WARNING", // "MY ERROR", "MY CRITICAL", "OFF" } /////////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +// Uncomment to disable default logger creation. +// This might save some small initialization time +// +// #define SPDLOG_DISABLE_DEFAULT_LOGGER +///////////////////////////////////////////////////////////////////////////////