From 76f62be24b7e612b1f6880f9d7b0ddc07a8d38eb Mon Sep 17 00:00:00 2001 From: crupest Date: Sat, 18 Apr 2020 00:22:41 +0800 Subject: ... --- include/cru/common/logger.hpp | 47 +++++++++++-------------------------------- 1 file changed, 12 insertions(+), 35 deletions(-) (limited to 'include/cru/common/logger.hpp') diff --git a/include/cru/common/logger.hpp b/include/cru/common/logger.hpp index b947ba99..38ddb6eb 100644 --- a/include/cru/common/logger.hpp +++ b/include/cru/common/logger.hpp @@ -60,56 +60,33 @@ class Logger : public Object { public: void Log(LogLevel level, const std::string_view& s); - template - void Debug(const std::string_view& format, TArgs&&... args) { -#ifdef CRU_DEBUG - Log(LogLevel::Debug, util::Format(format, std::forward(args)...)); -#endif - } - - template - void Info(const std::string_view& format, TArgs&&... args) { - Log(LogLevel::Info, util::Format(format, std::forward(args)...)); - } - - template - void Warn(const std::string_view& format, TArgs&&... args) { - Log(LogLevel::Warn, util::Format(format, std::forward(args)...)); - } - - template - void Error(const std::string_view& format, TArgs&&... args) { - Log(LogLevel::Error, util::Format(format, std::forward(args)...)); - } - public: std::list> sources_; }; template -void Debug([[maybe_unused]] const std::string_view& format, - [[maybe_unused]] TArgs&&... args) { +void Debug([[maybe_unused]] TArgs&&... args) { #ifdef CRU_DEBUG - Logger::GetInstance()->Log( - LogLevel::Debug, util::Format(format, std::forward(args)...)); + Logger::GetInstance()->Log(LogLevel::Debug, + util::Format(std::forward(args)...)); #endif } template -void Info(const std::string_view& format, TArgs&&... args) { - Logger::GetInstance()->Log( - LogLevel::Info, util::Format(format, std::forward(args)...)); +void Info(TArgs&&... args) { + Logger::GetInstance()->Log(LogLevel::Info, + util::Format(std::forward(args)...)); } template -void Warn(const std::string_view& format, TArgs&&... args) { - Logger::GetInstance()->Log( - LogLevel::Warn, util::Format(format, std::forward(args)...)); +void Warn(TArgs&&... args) { + Logger::GetInstance()->Log(LogLevel::Warn, + util::Format(std::forward(args)...)); } template -void Error(const std::string_view& format, TArgs&&... args) { - Logger::GetInstance()->Log( - LogLevel::Error, util::Format(format, std::forward(args)...)); +void Error(TArgs&&... args) { + Logger::GetInstance()->Log(LogLevel::Error, + util::Format(std::forward(args)...)); } } // namespace cru::log -- cgit v1.2.3