diff --git a/Source/init.cpp b/Source/init.cpp index 2e05c66a3..40869c1fd 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -14,7 +14,6 @@ #include "storm/storm.h" #include "utils/paths.h" #include "utils/ui_fwd.h" -#include "utils/log.hpp" #ifdef __vita__ // increase default allowed heap size on Vita diff --git a/Source/utils/log.hpp b/Source/utils/log.hpp index 4034c19b6..219ef9f0e 100644 --- a/Source/utils/log.hpp +++ b/Source/utils/log.hpp @@ -23,6 +23,8 @@ enum class LogCategory { Test = SDL_LOG_CATEGORY_TEST, }; +constexpr auto defaultCategory = LogCategory::Application; + enum class LogPriority { Verbose = SDL_LOG_PRIORITY_VERBOSE, Debug = SDL_LOG_PRIORITY_DEBUG, @@ -46,6 +48,12 @@ void LogVerbose(LogCategory category, const char *fmt, Args &&... args) SDL_LogVerbose(static_cast(category), "%s", str.c_str()); } +template +void LogVerbose(const char *fmt, Args &&... args) +{ + LogVerbose(defaultCategory, fmt, std::forward(args)...); +} + template void LogDebug(LogCategory category, const char *fmt, Args &&... args) { @@ -53,6 +61,12 @@ void LogDebug(LogCategory category, const char *fmt, Args &&... args) SDL_LogDebug(static_cast(category), "%s", str.c_str()); } +template +void LogDebug(const char *fmt, Args &&... args) +{ + LogDebug(defaultCategory, fmt, std::forward(args)...); +} + template void LogInfo(LogCategory category, const char *fmt, Args &&... args) { @@ -60,6 +74,12 @@ void LogInfo(LogCategory category, const char *fmt, Args &&... args) SDL_LogInfo(static_cast(category), "%s", str.c_str()); } +template +void LogInfo(const char *fmt, Args &&... args) +{ + LogInfo(defaultCategory, fmt, std::forward(args)...); +} + template void LogWarn(LogCategory category, const char *fmt, Args &&... args) { @@ -67,6 +87,12 @@ void LogWarn(LogCategory category, const char *fmt, Args &&... args) SDL_LogWarn(static_cast(category), "%s", str.c_str()); } +template +void LogWarn(const char *fmt, Args &&... args) +{ + LogWarn(defaultCategory, fmt, std::forward(args)...); +} + template void LogError(LogCategory category, const char *fmt, Args &&... args) { @@ -74,6 +100,12 @@ void LogError(LogCategory category, const char *fmt, Args &&... args) SDL_LogError(static_cast(category), "%s", str.c_str()); } +template +void LogError(const char *fmt, Args &&... args) +{ + LogError(defaultCategory, fmt, std::forward(args)...); +} + template void LogCritical(LogCategory category, const char *fmt, Args &&... args) { @@ -81,6 +113,12 @@ void LogCritical(LogCategory category, const char *fmt, Args &&... args) SDL_LogCritical(static_cast(category), "%s", str.c_str()); } +template +void LogCritical(const char *fmt, Args &&... args) +{ + LogCritical(defaultCategory, fmt, std::forward(args)...); +} + template void LogMessageV(LogCategory category, LogPriority priority, const char *fmt, Args &&... args) { @@ -88,4 +126,10 @@ void LogMessageV(LogCategory category, LogPriority priority, const char *fmt, Ar SDL_LogMessageV(static_cast(category), static_cast(priority), "%s", str.c_str()); } +template +void LogMessageV(const char *fmt, Args &&... args) +{ + LogMessageV(defaultCategory, fmt, std::forward(args)...); +} + } // namespace devilution