mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-31 09:39:15 +08:00
Clean context ctor
This commit is contained in:
parent
979902afc3
commit
8abaa0b383
@ -5,12 +5,7 @@
|
|||||||
#include "spdlog/logger.h"
|
#include "spdlog/logger.h"
|
||||||
|
|
||||||
#ifndef SPDLOG_DISABLE_GLOBAL_LOGGER
|
#ifndef SPDLOG_DISABLE_GLOBAL_LOGGER
|
||||||
// support for the global stdout color logger
|
#include "spdlog/sinks/stdout_color_sinks.h"
|
||||||
#ifdef _WIN32
|
|
||||||
#include "spdlog/sinks/wincolor_sink.h"
|
|
||||||
#else
|
|
||||||
#include "spdlog/sinks/ansicolor_sink.h"
|
|
||||||
#endif
|
|
||||||
#endif // SPDLOG_DISABLE_GLOBAL_LOGGER
|
#endif // SPDLOG_DISABLE_GLOBAL_LOGGER
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -20,15 +15,8 @@ namespace details {
|
|||||||
|
|
||||||
context::context() {
|
context::context() {
|
||||||
#ifndef SPDLOG_DISABLE_GLOBAL_LOGGER
|
#ifndef SPDLOG_DISABLE_GLOBAL_LOGGER
|
||||||
// create global logger (ansicolor_stdout_sink_mt or wincolor_stdout_sink_mt in windows).
|
auto color_sink = std::make_shared<sinks::stdout_color_sink_mt>();
|
||||||
#ifdef _WIN32
|
global_logger_ = std::make_shared<logger>(std::string(), std::move(color_sink));
|
||||||
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 *global_logger_name = "";
|
|
||||||
global_logger_ = std::make_shared<logger>(global_logger_name, std::move(color_sink));
|
|
||||||
|
|
||||||
#endif // SPDLOG_DISABLE_GLOBAL_LOGGER
|
#endif // SPDLOG_DISABLE_GLOBAL_LOGGER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user