5#include <SDL3/SDL_log.h>
6#include "SDL3pp_callbackWrapper.h"
7#include "SDL3pp_error.h"
8#include "SDL3pp_strings.h"
83 SDL_LOG_PRIORITY_INVALID;
88 SDL_LOG_PRIORITY_VERBOSE;
99 SDL_LOG_PRIORITY_CRITICAL;
138 : m_category(category)
148 : m_category(SDL_LogCategory(category))
209 SDL_LogMessage(m_category, priority,
"%s", (
const char*)(message));
238 template<
class... ARGS>
240 std::string_view fmt,
267 template<
class... ARGS>
268 void LogTrace(std::string_view fmt, ARGS&&... args)
const;
294 template<
class... ARGS>
295 void LogVerbose(std::string_view fmt, ARGS&&... args)
const;
322 template<
class... ARGS>
323 void LogDebug(std::string_view fmt, ARGS&&... args)
const;
350 template<
class... ARGS>
351 void LogInfo(std::string_view fmt, ARGS&&... args)
const;
378 template<
class... ARGS>
379 void LogWarn(std::string_view fmt, ARGS&&... args)
const;
406 template<
class... ARGS>
407 void LogError(std::string_view fmt, ARGS&&... args)
const;
434 template<
class... ARGS>
435 void LogCritical(std::string_view fmt, ARGS&&... args)
const;
439 SDL_LOG_CATEGORY_APPLICATION;
460 SDL_LOG_CATEGORY_RESERVED2;
463 SDL_LOG_CATEGORY_RESERVED3;
466 SDL_LOG_CATEGORY_RESERVED4;
469 SDL_LOG_CATEGORY_RESERVED5;
472 SDL_LOG_CATEGORY_RESERVED6;
475 SDL_LOG_CATEGORY_RESERVED7;
478 SDL_LOG_CATEGORY_RESERVED8;
481 SDL_LOG_CATEGORY_RESERVED9;
484 SDL_LOG_CATEGORY_RESERVED10;
502 SDL_SetLogPriorities(priority);
521 SDL_SetLogPriority(category, priority);
543 return SDL_GetLogPriority(category);
588 CheckError(SDL_SetLogPriorityPrefix(priority, prefix));
617 SDL_LogMessage(category, priority,
"%s",
static_cast<const char*
>(message));
641 SDL_Log(
"%s",
static_cast<const char*
>(message));
671template<
class... ARGS>
672inline void Log(std::string_view fmt, ARGS&&... args)
699template<
class... ARGS>
702 std::string_view fmt,
706 category, priority, std::vformat(fmt, std::make_format_args(args...)));
709template<
class... ARGS>
711 std::string_view fmt,
739template<
class... ARGS>
745template<
class... ARGS>
773template<
class... ARGS>
775 std::string_view fmt,
781template<
class... ARGS>
809template<
class... ARGS>
815template<
class... ARGS>
843template<
class... ARGS>
849template<
class... ARGS>
877template<
class... ARGS>
880 LogMessage(category, SDL_LOG_PRIORITY_WARN, fmt, args...);
883template<
class... ARGS>
911template<
class... ARGS>
914 LogMessage(category, SDL_LOG_PRIORITY_ERROR, fmt, args...);
917template<
class... ARGS>
945template<
class... ARGS>
947 std::string_view fmt,
950 LogMessage(category, SDL_LOG_PRIORITY_CRITICAL, fmt, args...);
953template<
class... ARGS>
976 const char* message);
996 void(
int category,
LogPriority priority,
const char* message)>;
1013 return SDL_GetDefaultLogOutputFunction();
1032 SDL_GetLogOutputFunction(callback, userdata);
1051 SDL_SetLogOutputFunction(callback, userdata);
The predefined log categories.
Definition SDL3pp_log.h:127
Helpers to use C++ strings parameters.
Definition SDL3pp_strings.h:58
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition SDL3pp_error.h:199
void SetLogPriorities(LogPriority priority)
Set the priority of all log categories.
Definition SDL3pp_log.h:500
constexpr LogCategory LOG_CATEGORY_ASSERT
ASSERT.
Definition SDL3pp_log.h:443
constexpr LogCategory LOG_CATEGORY_AUDIO
AUDIO.
Definition SDL3pp_log.h:447
void LogWarn(std::string_view fmt, ARGS &&... args) const
Log a message with LOG_PRIORITY_WARN.
Definition SDL3pp_log.h:884
constexpr LogCategory LOG_CATEGORY_VIDEO
VIDEO.
Definition SDL3pp_log.h:449
SDL_LogCategory LogCategoryRaw
Alias to raw representation for LogCategory.
Definition SDL3pp_log.h:62
constexpr LogCategory LOG_CATEGORY_RESERVED10
RESERVED10.
Definition SDL3pp_log.h:483
void LogVerbose(LogCategory category, std::string_view fmt, ARGS &&... args)
Log a message with LOG_PRIORITY_VERBOSE.
Definition SDL3pp_log.h:774
void SetLogPriorityPrefix(LogPriority priority, StringParam prefix)
Set the text prepended to log messages of a given priority.
Definition SDL3pp_log.h:586
LogPriority GetLogPriority(int category)
Get the priority of a particular log category.
Definition SDL3pp_log.h:541
void SetLogPriority(int category, LogPriority priority)
Set the priority of a particular log category.
Definition SDL3pp_log.h:519
void LogTrace(LogCategory category, std::string_view fmt, ARGS &&... args)
Log a message with LOG_PRIORITY_TRACE.
Definition SDL3pp_log.h:740
void LogUnformatted(LogPriority priority, StringParam message) const
Log an unformatted message with the specified priority.
Definition SDL3pp_log.h:207
constexpr LogPriority LOG_PRIORITY_INVALID
INVALID.
Definition SDL3pp_log.h:82
void SetLogOutputFunction(LogOutputFunction callback, void *userdata)
Replace the default log output function with one of your own.
Definition SDL3pp_log.h:1049
constexpr LogCategory LOG_CATEGORY_INPUT
INPUT.
Definition SDL3pp_log.h:453
constexpr LogCategory LOG_CATEGORY_ERROR
ERROR.
Definition SDL3pp_log.h:441
void LogInfo(std::string_view fmt, ARGS &&... args) const
Log a message with LOG_PRIORITY_INFO.
Definition SDL3pp_log.h:850
constexpr LogCategory(int category)
Wraps LogCategory.
Definition SDL3pp_log.h:147
constexpr LogCategory LOG_CATEGORY_RESERVED5
RESERVED5.
Definition SDL3pp_log.h:468
void LogVerbose(std::string_view fmt, ARGS &&... args) const
Log a message with LOG_PRIORITY_VERBOSE.
Definition SDL3pp_log.h:782
void LogCritical(LogCategory category, std::string_view fmt, ARGS &&... args)
Log a message with LOG_PRIORITY_CRITICAL.
Definition SDL3pp_log.h:946
void LogTrace(std::string_view fmt, ARGS &&... args) const
Log a message with LOG_PRIORITY_TRACE.
Definition SDL3pp_log.h:746
void ResetLogOutputFunction()
Replace the current log output function with the default one.
Definition SDL3pp_log.h:1082
constexpr LogPriority LOG_PRIORITY_CRITICAL
CRITICAL.
Definition SDL3pp_log.h:98
void LogCritical(std::string_view fmt, ARGS &&... args) const
Log a message with LOG_PRIORITY_CRITICAL.
Definition SDL3pp_log.h:954
void LogDebug(LogCategory category, std::string_view fmt, ARGS &&... args)
Log a message with LOG_PRIORITY_DEBUG.
Definition SDL3pp_log.h:810
constexpr LogCategory LOG_CATEGORY_RESERVED8
RESERVED8.
Definition SDL3pp_log.h:477
LogPriority GetLogPriority() const
Get the priority of a particular log category.
Definition SDL3pp_log.h:546
MakeFrontCallback< void(int category, LogPriority priority, const char *message)> LogOutputCB
The prototype for the log output callback function.
Definition SDL3pp_log.h:995
void LogError(std::string_view fmt, ARGS &&... args) const
Log a message with LOG_PRIORITY_ERROR.
Definition SDL3pp_log.h:918
constexpr LogCategory LOG_CATEGORY_RESERVED7
RESERVED7.
Definition SDL3pp_log.h:474
constexpr LogPriority LOG_PRIORITY_WARN
WARN.
Definition SDL3pp_log.h:94
void LogUnformatted(LogCategory category, LogPriority priority, StringParam message)
Log an unformatted message with LOG_CATEGORY_APPLICATION and LOG_PRIORITY_INFO.
Definition SDL3pp_log.h:613
void LogMessage(LogPriority priority, std::string_view fmt, ARGS... args) const
Log a message with the specified priority.
Definition SDL3pp_log.h:710
void LogDebug(std::string_view fmt, ARGS &&... args) const
Log a message with LOG_PRIORITY_DEBUG.
Definition SDL3pp_log.h:816
void LogError(LogCategory category, std::string_view fmt, ARGS &&... args)
Log a message with LOG_PRIORITY_ERROR.
Definition SDL3pp_log.h:912
constexpr LogCategory LOG_CATEGORY_TEST
TEST.
Definition SDL3pp_log.h:455
constexpr LogCategory LOG_CATEGORY_RESERVED2
RESERVED2.
Definition SDL3pp_log.h:459
constexpr LogPriority LOG_PRIORITY_DEBUG
DEBUG.
Definition SDL3pp_log.h:90
void LogMessage(LogCategory category, LogPriority priority, std::string_view fmt, ARGS... args)
Log a message with the specified category and priority.
Definition SDL3pp_log.h:700
void Log(std::string_view fmt, ARGS &&... args)
Log a message with LOG_CATEGORY_APPLICATION and LOG_PRIORITY_INFO.
Definition SDL3pp_log.h:672
constexpr LogCategory LOG_CATEGORY_RENDER
RENDER.
Definition SDL3pp_log.h:451
constexpr LogCategory LOG_CATEGORY_APPLICATION
APPLICATION.
Definition SDL3pp_log.h:438
void GetLogOutputFunction(LogOutputFunction *callback, void **userdata)
Get the current log output function.
Definition SDL3pp_log.h:1030
constexpr LogCategory LOG_CATEGORY_GPU
GPU.
Definition SDL3pp_log.h:457
void LogInfo(LogCategory category, std::string_view fmt, ARGS &&... args)
Log a message with LOG_PRIORITY_INFO.
Definition SDL3pp_log.h:844
constexpr LogCategory LOG_CATEGORY_SYSTEM
SYSTEM.
Definition SDL3pp_log.h:445
void SetLogPriority(LogPriority priority) const
Set the priority of a particular log category.
Definition SDL3pp_log.h:524
void(SDLCALL *)(void *userdata, int category, LogPriority priority, const char *message) LogOutputFunction
The prototype for the log output callback function.
Definition SDL3pp_log.h:973
void ResetLogPriorities()
Reset all priorities to default.
Definition SDL3pp_log.h:563
constexpr LogPriority LOG_PRIORITY_ERROR
ERROR.
Definition SDL3pp_log.h:96
constexpr LogPriority LOG_PRIORITY_COUNT
COUNT.
Definition SDL3pp_log.h:101
void LogWarn(LogCategory category, std::string_view fmt, ARGS &&... args)
Log a message with LOG_PRIORITY_WARN.
Definition SDL3pp_log.h:878
SDL_LogPriority LogPriority
The predefined log priorities.
Definition SDL3pp_log.h:80
LogOutputFunction GetDefaultLogOutputFunction()
Get the default log output function.
Definition SDL3pp_log.h:1011
constexpr LogPriority LOG_PRIORITY_VERBOSE
VERBOSE.
Definition SDL3pp_log.h:87
constexpr LogCategory(LogCategoryRaw category=SDL_LOG_CATEGORY_APPLICATION) noexcept
Wraps LogCategory.
Definition SDL3pp_log.h:136
constexpr LogPriority LOG_PRIORITY_INFO
INFO.
Definition SDL3pp_log.h:92
constexpr LogCategory LOG_CATEGORY_RESERVED9
RESERVED9.
Definition SDL3pp_log.h:480
constexpr LogCategory LOG_CATEGORY_RESERVED4
RESERVED4.
Definition SDL3pp_log.h:465
constexpr LogPriority LOG_PRIORITY_TRACE
TRACE.
Definition SDL3pp_log.h:85
constexpr LogCategory LOG_CATEGORY_CUSTOM
CUSTOM.
Definition SDL3pp_log.h:486
constexpr LogCategory LOG_CATEGORY_RESERVED3
RESERVED3.
Definition SDL3pp_log.h:462
constexpr LogCategory LOG_CATEGORY_RESERVED6
RESERVED6.
Definition SDL3pp_log.h:471
Main include header for the SDL3pp library.
Definition SDL3pp_callbackWrapper.h:169