create_console_logger now uses the correct color sink depending on your platform

pull/194/head^2
Christopher Torres 10 years ago
parent 62d177be28
commit 3fac9ba212
No known key found for this signature in database
GPG Key ID: D26CE56FC38D0C83

@ -14,6 +14,7 @@
#include <spdlog/sinks/stdout_sinks.h>
#include <spdlog/sinks/syslog_sink.h>
#include <spdlog/sinks/ansicolor_sink.h>
#include <spdlog/sinks/wincolor_sink.h>
#include <chrono>
#include <functional>
@ -61,7 +62,11 @@ inline std::shared_ptr<spdlog::logger> spdlog::daily_logger_st(const std::string
inline std::shared_ptr<spdlog::logger> create_console_logger(const std::string& logger_name, spdlog::sink_ptr sink, bool color)
{
if (color) //use color wrapper sink
#ifdef _WIN32
sink = std::make_shared<spdlog::sinks::wincolor_sink>(sink);
#else
sink = std::make_shared<spdlog::sinks::ansicolor_sink>(sink);
#endif
return spdlog::details::registry::instance().create(logger_name, sink);
}

Loading…
Cancel
Save