|
|
|
@ -39,7 +39,7 @@ enum class LogPriority { |
|
|
|
namespace detail { |
|
|
|
namespace detail { |
|
|
|
|
|
|
|
|
|
|
|
template <typename... Args> |
|
|
|
template <typename... Args> |
|
|
|
std::string format(const char *fmt, Args &&... args) |
|
|
|
std::string format(const char *fmt, Args &&...args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
FMT_TRY |
|
|
|
FMT_TRY |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -56,99 +56,99 @@ std::string format(const char *fmt, Args &&... args) |
|
|
|
} // namespace detail
|
|
|
|
} // namespace detail
|
|
|
|
|
|
|
|
|
|
|
|
template <typename... Args> |
|
|
|
template <typename... Args> |
|
|
|
void Log(const char *fmt, Args &&... args) |
|
|
|
void Log(const char *fmt, Args &&...args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
auto str = detail::format(fmt, std::forward<Args>(args)...); |
|
|
|
auto str = detail::format(fmt, std::forward<Args>(args)...); |
|
|
|
SDL_Log("%s", str.c_str()); |
|
|
|
SDL_Log("%s", str.c_str()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename... Args> |
|
|
|
template <typename... Args> |
|
|
|
void LogVerbose(LogCategory category, const char *fmt, Args &&... args) |
|
|
|
void LogVerbose(LogCategory category, const char *fmt, Args &&...args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
auto str = detail::format(fmt, std::forward<Args>(args)...); |
|
|
|
auto str = detail::format(fmt, std::forward<Args>(args)...); |
|
|
|
SDL_LogVerbose(static_cast<int>(category), "%s", str.c_str()); |
|
|
|
SDL_LogVerbose(static_cast<int>(category), "%s", str.c_str()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename... Args> |
|
|
|
template <typename... Args> |
|
|
|
void LogVerbose(const char *fmt, Args &&... args) |
|
|
|
void LogVerbose(const char *fmt, Args &&...args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogVerbose(defaultCategory, fmt, std::forward<Args>(args)...); |
|
|
|
LogVerbose(defaultCategory, fmt, std::forward<Args>(args)...); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename... Args> |
|
|
|
template <typename... Args> |
|
|
|
void LogDebug(LogCategory category, const char *fmt, Args &&... args) |
|
|
|
void LogDebug(LogCategory category, const char *fmt, Args &&...args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
auto str = detail::format(fmt, std::forward<Args>(args)...); |
|
|
|
auto str = detail::format(fmt, std::forward<Args>(args)...); |
|
|
|
SDL_LogDebug(static_cast<int>(category), "%s", str.c_str()); |
|
|
|
SDL_LogDebug(static_cast<int>(category), "%s", str.c_str()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename... Args> |
|
|
|
template <typename... Args> |
|
|
|
void LogDebug(const char *fmt, Args &&... args) |
|
|
|
void LogDebug(const char *fmt, Args &&...args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogDebug(defaultCategory, fmt, std::forward<Args>(args)...); |
|
|
|
LogDebug(defaultCategory, fmt, std::forward<Args>(args)...); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename... Args> |
|
|
|
template <typename... Args> |
|
|
|
void LogInfo(LogCategory category, const char *fmt, Args &&... args) |
|
|
|
void LogInfo(LogCategory category, const char *fmt, Args &&...args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
auto str = detail::format(fmt, std::forward<Args>(args)...); |
|
|
|
auto str = detail::format(fmt, std::forward<Args>(args)...); |
|
|
|
SDL_LogInfo(static_cast<int>(category), "%s", str.c_str()); |
|
|
|
SDL_LogInfo(static_cast<int>(category), "%s", str.c_str()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename... Args> |
|
|
|
template <typename... Args> |
|
|
|
void LogInfo(const char *fmt, Args &&... args) |
|
|
|
void LogInfo(const char *fmt, Args &&...args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogInfo(defaultCategory, fmt, std::forward<Args>(args)...); |
|
|
|
LogInfo(defaultCategory, fmt, std::forward<Args>(args)...); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename... Args> |
|
|
|
template <typename... Args> |
|
|
|
void LogWarn(LogCategory category, const char *fmt, Args &&... args) |
|
|
|
void LogWarn(LogCategory category, const char *fmt, Args &&...args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
auto str = detail::format(fmt, std::forward<Args>(args)...); |
|
|
|
auto str = detail::format(fmt, std::forward<Args>(args)...); |
|
|
|
SDL_LogWarn(static_cast<int>(category), "%s", str.c_str()); |
|
|
|
SDL_LogWarn(static_cast<int>(category), "%s", str.c_str()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename... Args> |
|
|
|
template <typename... Args> |
|
|
|
void LogWarn(const char *fmt, Args &&... args) |
|
|
|
void LogWarn(const char *fmt, Args &&...args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogWarn(defaultCategory, fmt, std::forward<Args>(args)...); |
|
|
|
LogWarn(defaultCategory, fmt, std::forward<Args>(args)...); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename... Args> |
|
|
|
template <typename... Args> |
|
|
|
void LogError(LogCategory category, const char *fmt, Args &&... args) |
|
|
|
void LogError(LogCategory category, const char *fmt, Args &&...args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
auto str = detail::format(fmt, std::forward<Args>(args)...); |
|
|
|
auto str = detail::format(fmt, std::forward<Args>(args)...); |
|
|
|
SDL_LogError(static_cast<int>(category), "%s", str.c_str()); |
|
|
|
SDL_LogError(static_cast<int>(category), "%s", str.c_str()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename... Args> |
|
|
|
template <typename... Args> |
|
|
|
void LogError(const char *fmt, Args &&... args) |
|
|
|
void LogError(const char *fmt, Args &&...args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogError(defaultCategory, fmt, std::forward<Args>(args)...); |
|
|
|
LogError(defaultCategory, fmt, std::forward<Args>(args)...); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename... Args> |
|
|
|
template <typename... Args> |
|
|
|
void LogCritical(LogCategory category, const char *fmt, Args &&... args) |
|
|
|
void LogCritical(LogCategory category, const char *fmt, Args &&...args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
auto str = detail::format(fmt, std::forward<Args>(args)...); |
|
|
|
auto str = detail::format(fmt, std::forward<Args>(args)...); |
|
|
|
SDL_LogCritical(static_cast<int>(category), "%s", str.c_str()); |
|
|
|
SDL_LogCritical(static_cast<int>(category), "%s", str.c_str()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename... Args> |
|
|
|
template <typename... Args> |
|
|
|
void LogCritical(const char *fmt, Args &&... args) |
|
|
|
void LogCritical(const char *fmt, Args &&...args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogCritical(defaultCategory, fmt, std::forward<Args>(args)...); |
|
|
|
LogCritical(defaultCategory, fmt, std::forward<Args>(args)...); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename... Args> |
|
|
|
template <typename... Args> |
|
|
|
void LogMessageV(LogCategory category, LogPriority priority, const char *fmt, Args &&... args) |
|
|
|
void LogMessageV(LogCategory category, LogPriority priority, const char *fmt, Args &&...args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
auto str = detail::format(fmt, std::forward<Args>(args)...); |
|
|
|
auto str = detail::format(fmt, std::forward<Args>(args)...); |
|
|
|
SDL_LogMessageV(static_cast<int>(category), static_cast<SDL_LogPriority>(priority), "%s", str.c_str()); |
|
|
|
SDL_LogMessageV(static_cast<int>(category), static_cast<SDL_LogPriority>(priority), "%s", str.c_str()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
template <typename... Args> |
|
|
|
template <typename... Args> |
|
|
|
void LogMessageV(const char *fmt, Args &&... args) |
|
|
|
void LogMessageV(const char *fmt, Args &&...args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogMessageV(defaultCategory, fmt, std::forward<Args>(args)...); |
|
|
|
LogMessageV(defaultCategory, fmt, std::forward<Args>(args)...); |
|
|
|
} |
|
|
|
} |
|
|
|
|