mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 02:19:35 +08:00
Moved default sync factory to seperate file to avoid cyclic includes
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "spdlog/details/registry.h"
|
||||
#include "spdlog/logger.h"
|
||||
#include "spdlog/version.h"
|
||||
#include "spdlog/details/synchronous_factory.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
@@ -21,19 +22,6 @@
|
||||
|
||||
namespace spdlog {
|
||||
|
||||
// Default logger factory- creates synchronous loggers
|
||||
struct synchronous_factory
|
||||
{
|
||||
template<typename Sink, typename... SinkArgs>
|
||||
static std::shared_ptr<spdlog::logger> create(std::string logger_name, SinkArgs &&... args)
|
||||
{
|
||||
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().initialize_logger(new_logger);
|
||||
return new_logger;
|
||||
}
|
||||
};
|
||||
|
||||
using default_factory = synchronous_factory;
|
||||
|
||||
// Create and register a logger with a templated sink type
|
||||
|
Reference in New Issue
Block a user