mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 02:19:35 +08:00
* using API call instead of macro for toggling automatic registration
* added unit test for disabling automatic registration
This commit is contained in:
@@ -29,10 +29,7 @@ struct synchronous_factory
|
||||
{
|
||||
auto sink = std::make_shared<Sink>(std::forward<SinkArgs>(args)...);
|
||||
auto new_logger = std::make_shared<logger>(std::move(logger_name), std::move(sink));
|
||||
details::registry::instance().init_with_global_defaults(new_logger);
|
||||
#ifndef SPDLOG_DISABLE_GLOBAL_REGISTRATION
|
||||
details::registry::instance().register_logger(new_logger);
|
||||
#endif
|
||||
details::registry::instance().initialize_logger(new_logger);
|
||||
return new_logger;
|
||||
}
|
||||
};
|
||||
@@ -128,6 +125,12 @@ inline void shutdown()
|
||||
details::registry::instance().shutdown();
|
||||
}
|
||||
|
||||
// Automatic registration of loggers when using spdlog::create() or spdlog::create_async
|
||||
inline void set_automatic_registration(bool automatic_registation)
|
||||
{
|
||||
details::registry::instance().set_automatic_registration(automatic_registation);
|
||||
}
|
||||
|
||||
// API for using default logger (stdout_color_mt),
|
||||
// e.g: spdlog::info("Message {}", 1);
|
||||
//
|
||||
|
Reference in New Issue
Block a user