mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-31 01:29:21 +08:00
Moved default logger ctor to spdlog.cpp
This commit is contained in:
parent
8abaa0b383
commit
79df003092
@ -23,8 +23,9 @@ class thread_pool;
|
||||
|
||||
class SPDLOG_API context {
|
||||
public:
|
||||
context();
|
||||
~context();
|
||||
context() = default;
|
||||
explicit context(std::unique_ptr<logger> global_logger);
|
||||
~context() = default;
|
||||
context(const context &) = delete;
|
||||
context &operator=(const context &) = delete;
|
||||
|
||||
|
@ -13,15 +13,10 @@
|
||||
namespace spdlog {
|
||||
namespace details {
|
||||
|
||||
context::context() {
|
||||
#ifndef SPDLOG_DISABLE_GLOBAL_LOGGER
|
||||
auto color_sink = std::make_shared<sinks::stdout_color_sink_mt>();
|
||||
global_logger_ = std::make_shared<logger>(std::string(), std::move(color_sink));
|
||||
#endif // SPDLOG_DISABLE_GLOBAL_LOGGER
|
||||
context::context(std::unique_ptr<logger> global_logger) {
|
||||
global_logger_ = std::move(global_logger);
|
||||
}
|
||||
|
||||
context::~context() = default;
|
||||
|
||||
std::shared_ptr<logger> context::global_logger() {
|
||||
return global_logger_;
|
||||
}
|
||||
|
@ -12,7 +12,12 @@
|
||||
|
||||
namespace spdlog {
|
||||
|
||||
static std::shared_ptr<details::context> s_context = std::make_unique<details::context>();
|
||||
#ifndef SPDLOG_DISABLE_GLOBAL_LOGGER
|
||||
static std::shared_ptr s_context =
|
||||
std::make_unique<details::context>(std::make_unique<logger>("", std::make_unique<sinks::stdout_color_sink_mt>()));
|
||||
#else
|
||||
static std::shared_ptr s_context = std::make_unique<details::context>();
|
||||
#endif
|
||||
|
||||
void set_context(std::shared_ptr<details::context> context) { s_context = std::move(context); }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user