From 279379c15ddc46baf7a67246aaff5aa38cd35b3b Mon Sep 17 00:00:00 2001 From: Riyyi Date: Sat, 30 Jan 2021 21:27:56 +0100 Subject: [PATCH] Fix logs: empty logs should print a newline --- inferno/src/inferno/io/log.cpp | 4 -- inferno/src/inferno/io/log.h | 82 +++++++++++++++++----------------- 2 files changed, 41 insertions(+), 45 deletions(-) diff --git a/inferno/src/inferno/io/log.cpp b/inferno/src/inferno/io/log.cpp index 999bcf0..b44df33 100644 --- a/inferno/src/inferno/io/log.cpp +++ b/inferno/src/inferno/io/log.cpp @@ -52,10 +52,6 @@ namespace Inferno { DebugLogStream::~DebugLogStream() { - if (empty()) { - return; - } - if (m_type != Log::None) { const char* clear = "\033[0m"; write(clear, strlen(clear)); diff --git a/inferno/src/inferno/io/log.h b/inferno/src/inferno/io/log.h index c663a1d..326c6e5 100644 --- a/inferno/src/inferno/io/log.h +++ b/inferno/src/inferno/io/log.h @@ -152,47 +152,47 @@ namespace Inferno { // ----------------------------------------- - template void dbgln(const char* format, P&&... parameters) { return dbgln(Log::None, true, format, std::forward

(parameters)...); } - template void infoln(const char* format, P&&... parameters) { return dbgln(Log::Info, true, format, std::forward

(parameters)...); } - template void warnln(const char* format, P&&... parameters) { return dbgln(Log::Warn, true, format, std::forward

(parameters)...); } - template void dangerln(const char* format, P&&... parameters) { return dbgln(Log::Danger, true, format, std::forward

(parameters)...); } - template void successln(const char* format, P&&... parameters) { return dbgln(Log::Success, true, format, std::forward

(parameters)...); } - template void commentln(const char* format, P&&... parameters) { return dbgln(Log::Comment, true, format, std::forward

(parameters)...); } - - template void dbgln(const std::string& format, P&&... parameters) { return dbgln(Log::None, true, format.c_str(), std::forward

(parameters)...); } - template void infoln(const std::string& format, P&&... parameters) { return dbgln(Log::Info, true, format.c_str(), std::forward

(parameters)...); } - template void warnln(const std::string& format, P&&... parameters) { return dbgln(Log::Warn, true, format.c_str(), std::forward

(parameters)...); } - template void dangerln(const std::string& format, P&&... parameters) { return dbgln(Log::Danger, true, format.c_str(), std::forward

(parameters)...); } - template void successln(const std::string& format, P&&... parameters) { return dbgln(Log::Success, true, format.c_str(), std::forward

(parameters)...); } - template void commentln(const std::string& format, P&&... parameters) { return dbgln(Log::Comment, true, format.c_str(), std::forward

(parameters)...); } - - template void dbgln(const std::string_view& format, P&&... parameters) { return dbgln(Log::None, true, format.data(), std::forward

(parameters)...); } - template void infoln(const std::string_view& format, P&&... parameters) { return dbgln(Log::Info, true, format.data(), std::forward

(parameters)...); } - template void warnln(const std::string_view& format, P&&... parameters) { return dbgln(Log::Warn, true, format.data(), std::forward

(parameters)...); } - template void dangerln(const std::string_view& format, P&&... parameters) { return dbgln(Log::Danger, true, format.data(), std::forward

(parameters)...); } - template void successln(const std::string_view& format, P&&... parameters) { return dbgln(Log::Success, true, format.data(), std::forward

(parameters)...); } - template void commentln(const std::string_view& format, P&&... parameters) { return dbgln(Log::Comment, true, format.data(), std::forward

(parameters)...); } - - template void dbgln(bool newline, const char* format, P&&... parameters) { return dbgln(Log::None, newline, format, std::forward

(parameters)...); } - template void infoln(bool newline, const char* format, P&&... parameters) { return dbgln(Log::Info, newline, format, std::forward

(parameters)...); } - template void warnln(bool newline, const char* format, P&&... parameters) { return dbgln(Log::Warn, newline, format, std::forward

(parameters)...); } - template void dangerln(bool newline, const char* format, P&&... parameters) { return dbgln(Log::Danger, newline, format, std::forward

(parameters)...); } - template void successln(bool newline, const char* format, P&&... parameters) { return dbgln(Log::Success, newline, format, std::forward

(parameters)...); } - template void commentln(bool newline, const char* format, P&&... parameters) { return dbgln(Log::Comment, newline, format, std::forward

(parameters)...); } - - template void dbgln(bool newline, const std::string& format, P&&... parameters) { return dbgln(Log::None, newline, format.c_str(), std::forward

(parameters)...); } - template void infoln(bool newline, const std::string& format, P&&... parameters) { return dbgln(Log::Info, newline, format.c_str(), std::forward

(parameters)...); } - template void warnln(bool newline, const std::string& format, P&&... parameters) { return dbgln(Log::Warn, newline, format.c_str(), std::forward

(parameters)...); } - template void dangerln(bool newline, const std::string& format, P&&... parameters) { return dbgln(Log::Danger, newline, format.c_str(), std::forward

(parameters)...); } - template void successln(bool newline, const std::string& format, P&&... parameters) { return dbgln(Log::Success, newline, format.c_str(), std::forward

(parameters)...); } - template void commentln(bool newline, const std::string& format, P&&... parameters) { return dbgln(Log::Comment, newline, format.c_str(), std::forward

(parameters)...); } - - template void dbgln(bool newline, const std::string_view& format, P&&... parameters) { return dbgln(Log::None, newline, format.data(), std::forward

(parameters)...); } - template void infoln(bool newline, const std::string_view& format, P&&... parameters) { return dbgln(Log::Info, newline, format.data(), std::forward

(parameters)...); } - template void warnln(bool newline, const std::string_view& format, P&&... parameters) { return dbgln(Log::Warn, newline, format.data(), std::forward

(parameters)...); } - template void dangerln(bool newline, const std::string_view& format, P&&... parameters) { return dbgln(Log::Danger, newline, format.data(), std::forward

(parameters)...); } - template void successln(bool newline, const std::string_view& format, P&&... parameters) { return dbgln(Log::Success, newline, format.data(), std::forward

(parameters)...); } - template void commentln(bool newline, const std::string_view& format, P&&... parameters) { return dbgln(Log::Comment, newline, format.data(), std::forward

(parameters)...); } + template void dbgln(const char* format, P&&... parameters) { dbgln(Log::None, true, format, std::forward

(parameters)...); } + template void infoln(const char* format, P&&... parameters) { dbgln(Log::Info, true, format, std::forward

(parameters)...); } + template void warnln(const char* format, P&&... parameters) { dbgln(Log::Warn, true, format, std::forward

(parameters)...); } + template void dangerln(const char* format, P&&... parameters) { dbgln(Log::Danger, true, format, std::forward

(parameters)...); } + template void successln(const char* format, P&&... parameters) { dbgln(Log::Success, true, format, std::forward

(parameters)...); } + template void commentln(const char* format, P&&... parameters) { dbgln(Log::Comment, true, format, std::forward

(parameters)...); } + + template void dbgln(const std::string& format, P&&... parameters) { dbgln(Log::None, true, format.c_str(), std::forward

(parameters)...); } + template void infoln(const std::string& format, P&&... parameters) { dbgln(Log::Info, true, format.c_str(), std::forward

(parameters)...); } + template void warnln(const std::string& format, P&&... parameters) { dbgln(Log::Warn, true, format.c_str(), std::forward

(parameters)...); } + template void dangerln(const std::string& format, P&&... parameters) { dbgln(Log::Danger, true, format.c_str(), std::forward

(parameters)...); } + template void successln(const std::string& format, P&&... parameters) { dbgln(Log::Success, true, format.c_str(), std::forward

(parameters)...); } + template void commentln(const std::string& format, P&&... parameters) { dbgln(Log::Comment, true, format.c_str(), std::forward

(parameters)...); } + + template void dbgln(const std::string_view& format, P&&... parameters) { dbgln(Log::None, true, format.data(), std::forward

(parameters)...); } + template void infoln(const std::string_view& format, P&&... parameters) { dbgln(Log::Info, true, format.data(), std::forward

(parameters)...); } + template void warnln(const std::string_view& format, P&&... parameters) { dbgln(Log::Warn, true, format.data(), std::forward

(parameters)...); } + template void dangerln(const std::string_view& format, P&&... parameters) { dbgln(Log::Danger, true, format.data(), std::forward

(parameters)...); } + template void successln(const std::string_view& format, P&&... parameters) { dbgln(Log::Success, true, format.data(), std::forward

(parameters)...); } + template void commentln(const std::string_view& format, P&&... parameters) { dbgln(Log::Comment, true, format.data(), std::forward

(parameters)...); } + + template void dbgln(bool newline, const char* format, P&&... parameters) { dbgln(Log::None, newline, format, std::forward

(parameters)...); } + template void infoln(bool newline, const char* format, P&&... parameters) { dbgln(Log::Info, newline, format, std::forward

(parameters)...); } + template void warnln(bool newline, const char* format, P&&... parameters) { dbgln(Log::Warn, newline, format, std::forward

(parameters)...); } + template void dangerln(bool newline, const char* format, P&&... parameters) { dbgln(Log::Danger, newline, format, std::forward

(parameters)...); } + template void successln(bool newline, const char* format, P&&... parameters) { dbgln(Log::Success, newline, format, std::forward

(parameters)...); } + template void commentln(bool newline, const char* format, P&&... parameters) { dbgln(Log::Comment, newline, format, std::forward

(parameters)...); } + + template void dbgln(bool newline, const std::string& format, P&&... parameters) { dbgln(Log::None, newline, format.c_str(), std::forward

(parameters)...); } + template void infoln(bool newline, const std::string& format, P&&... parameters) { dbgln(Log::Info, newline, format.c_str(), std::forward

(parameters)...); } + template void warnln(bool newline, const std::string& format, P&&... parameters) { dbgln(Log::Warn, newline, format.c_str(), std::forward

(parameters)...); } + template void dangerln(bool newline, const std::string& format, P&&... parameters) { dbgln(Log::Danger, newline, format.c_str(), std::forward

(parameters)...); } + template void successln(bool newline, const std::string& format, P&&... parameters) { dbgln(Log::Success, newline, format.c_str(), std::forward

(parameters)...); } + template void commentln(bool newline, const std::string& format, P&&... parameters) { dbgln(Log::Comment, newline, format.c_str(), std::forward

(parameters)...); } + + template void dbgln(bool newline, const std::string_view& format, P&&... parameters) { dbgln(Log::None, newline, format.data(), std::forward

(parameters)...); } + template void infoln(bool newline, const std::string_view& format, P&&... parameters) { dbgln(Log::Info, newline, format.data(), std::forward

(parameters)...); } + template void warnln(bool newline, const std::string_view& format, P&&... parameters) { dbgln(Log::Warn, newline, format.data(), std::forward

(parameters)...); } + template void dangerln(bool newline, const std::string_view& format, P&&... parameters) { dbgln(Log::Danger, newline, format.data(), std::forward

(parameters)...); } + template void successln(bool newline, const std::string_view& format, P&&... parameters) { dbgln(Log::Success, newline, format.data(), std::forward

(parameters)...); } + template void commentln(bool newline, const std::string_view& format, P&&... parameters) { dbgln(Log::Comment, newline, format.data(), std::forward

(parameters)...); } // -----------------------------------------