From 8b4eedb594b2034c39e1eb66f40453d2c7b070ac Mon Sep 17 00:00:00 2001 From: gabime Date: Sun, 12 May 2019 16:11:35 +0300 Subject: [PATCH] More template instantiations for static lib --- include/spdlog/sinks/stdout_color_sinks-inl.h | 34 +++++++++++++++++++ include/spdlog/sinks/stdout_color_sinks.h | 25 +++++--------- include/spdlog/sinks/wincolor_sink-inl.h | 6 ++-- include/spdlog/sinks/wincolor_sink.h | 4 +++ 4 files changed, 51 insertions(+), 18 deletions(-) create mode 100644 include/spdlog/sinks/stdout_color_sinks-inl.h diff --git a/include/spdlog/sinks/stdout_color_sinks-inl.h b/include/spdlog/sinks/stdout_color_sinks-inl.h new file mode 100644 index 00000000..018aaf5e --- /dev/null +++ b/include/spdlog/sinks/stdout_color_sinks-inl.h @@ -0,0 +1,34 @@ +// Copyright(c) 2015-present Gabi Melman & spdlog contributors. +// Distributed under the MIT License (http://opensource.org/licenses/MIT) + +#pragma once + +#include "spdlog/logger.h" +#include "spdlog/common.h" + +namespace spdlog { + +template +SPDLOG_INLINE std::shared_ptr stdout_color_mt(const std::string &logger_name) +{ + return Factory::template create(logger_name); +} + +template +SPDLOG_INLINE std::shared_ptr stdout_color_st(const std::string &logger_name) +{ + return Factory::template create(logger_name); +} + +template +SPDLOG_INLINE std::shared_ptr stderr_color_mt(const std::string &logger_name) +{ + return Factory::template create(logger_name); +} + +template +SPDLOG_INLINE std::shared_ptr stderr_color_st(const std::string &logger_name) +{ + return Factory::template create(logger_name); +} +} // namespace spdlog \ No newline at end of file diff --git a/include/spdlog/sinks/stdout_color_sinks.h b/include/spdlog/sinks/stdout_color_sinks.h index bc8fcbab..fe1452e5 100644 --- a/include/spdlog/sinks/stdout_color_sinks.h +++ b/include/spdlog/sinks/stdout_color_sinks.h @@ -29,26 +29,19 @@ using stderr_color_sink_st = ansicolor_stderr_sink_st; } // namespace sinks template -inline std::shared_ptr stdout_color_mt(const std::string &logger_name) -{ - return Factory::template create(logger_name); -} +std::shared_ptr stdout_color_mt(const std::string &logger_name); template -inline std::shared_ptr stdout_color_st(const std::string &logger_name) -{ - return Factory::template create(logger_name); -} +std::shared_ptr stdout_color_st(const std::string &logger_name); template -inline std::shared_ptr stderr_color_mt(const std::string &logger_name) -{ - return Factory::template create(logger_name); -} +std::shared_ptr stderr_color_mt(const std::string &logger_name); template -inline std::shared_ptr stderr_color_st(const std::string &logger_name) -{ - return Factory::template create(logger_name); -} +std::shared_ptr stderr_color_st(const std::string &logger_name); + } // namespace spdlog + +#ifdef SPDLOG_HEADER_ONLY +#include "stdout_color_sinks-inl.h" +#endif \ No newline at end of file diff --git a/include/spdlog/sinks/wincolor_sink-inl.h b/include/spdlog/sinks/wincolor_sink-inl.h index e778496f..8600e0ad 100644 --- a/include/spdlog/sinks/wincolor_sink-inl.h +++ b/include/spdlog/sinks/wincolor_sink-inl.h @@ -1,5 +1,7 @@ -#pragma once +// Copyright(c) 2015-present Gabi Melman & spdlog contributors. +// Distributed under the MIT License (http://opensource.org/licenses/MIT) +#pragma once namespace spdlog { namespace sinks { @@ -18,7 +20,7 @@ SPDLOG_INLINE wincolor_sink::wincolor_sink() } template -SPDLOG_INLINE SPDLOG_INLINE wincolor_sink::~wincolor_sink() +SPDLOG_INLINE wincolor_sink::~wincolor_sink() { this->flush(); } diff --git a/include/spdlog/sinks/wincolor_sink.h b/include/spdlog/sinks/wincolor_sink.h index fd17b3d6..7645819c 100644 --- a/include/spdlog/sinks/wincolor_sink.h +++ b/include/spdlog/sinks/wincolor_sink.h @@ -69,3 +69,7 @@ using wincolor_stderr_sink_st = wincolor_sink