Browse Source

Set Application as the default log category

Remove example of logging a container
pull/1689/head
Jmgr 5 years ago committed by Anders Jenbo
parent
commit
af0ea6fdfc
  1. 1
      Source/init.cpp
  2. 44
      Source/utils/log.hpp

1
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

44
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<int>(category), "%s", str.c_str());
}
template <typename... Args>
void LogVerbose(const char *fmt, Args &&... args)
{
LogVerbose(defaultCategory, fmt, std::forward<Args>(args)...);
}
template <typename... Args>
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<int>(category), "%s", str.c_str());
}
template <typename... Args>
void LogDebug(const char *fmt, Args &&... args)
{
LogDebug(defaultCategory, fmt, std::forward<Args>(args)...);
}
template <typename... Args>
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<int>(category), "%s", str.c_str());
}
template <typename... Args>
void LogInfo(const char *fmt, Args &&... args)
{
LogInfo(defaultCategory, fmt, std::forward<Args>(args)...);
}
template <typename... Args>
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<int>(category), "%s", str.c_str());
}
template <typename... Args>
void LogWarn(const char *fmt, Args &&... args)
{
LogWarn(defaultCategory, fmt, std::forward<Args>(args)...);
}
template <typename... Args>
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<int>(category), "%s", str.c_str());
}
template <typename... Args>
void LogError(const char *fmt, Args &&... args)
{
LogError(defaultCategory, fmt, std::forward<Args>(args)...);
}
template <typename... Args>
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<int>(category), "%s", str.c_str());
}
template <typename... Args>
void LogCritical(const char *fmt, Args &&... args)
{
LogCritical(defaultCategory, fmt, std::forward<Args>(args)...);
}
template <typename... Args>
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<int>(category), static_cast<SDL_LogPriority>(priority), "%s", str.c_str());
}
template <typename... Args>
void LogMessageV(const char *fmt, Args &&... args)
{
LogMessageV(defaultCategory, fmt, std::forward<Args>(args)...);
}
} // namespace devilution

Loading…
Cancel
Save