ObjectivelyMVC
Object oriented MVC framework for SDL3 and GNU C
Loading...
Searching...
No Matches
Log.h File Reference

View logging facilities via SDL_Log. More...

#include <stdlib.h>
#include <SDL3/SDL_log.h>

Go to the source code of this file.

Macros

#define LOG_CATEGORY_MVC   (SDL_LOG_CATEGORY_CUSTOM + 69)
 
#define MVC_Assert(cond, fmt, ...)
 Asserts that cond is true, logging the SDL error and exiting on failure.
 
#define MVC_LogCritical(fmt, ...)    SDL_LogCritical(LOG_CATEGORY_MVC, "%s::%s: "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)
 
#define MVC_LogDebug(fmt, ...)    SDL_LogDebug(LOG_CATEGORY_MVC, "%s::%s: "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)
 
#define MVC_LogEnabled(priority)    (SDL_GetLogPriority(LOG_CATEGORY_MVC) <= priority)
 
#define MVC_LogError(fmt, ...)    SDL_LogError(LOG_CATEGORY_MVC, "%s::%s: "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)
 
#define MVC_LogInfo(fmt, ...)    SDL_LogInfo(LOG_CATEGORY_MVC, "%s::%s: "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)
 
#define MVC_LogMessage(priority, fmt, ...)    SDL_LogMessage(LOG_CATEGORY_MVC, priority, "%s::%s "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)
 
#define MVC_LogSetPriority(priority)   SDL_SetLogPriority(LOG_CATEGORY_MVC, priority)
 
#define MVC_LogVerbose(fmt, ...)    SDL_LogVerbose(LOG_CATEGORY_MVC, "%s::%s: "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)
 
#define MVC_LogWarn(fmt, ...)    SDL_LogWarn(LOG_CATEGORY_MVC, "%s::%s: "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)
 

Detailed Description

View logging facilities via SDL_Log.

Definition in file Log.h.

Macro Definition Documentation

◆ LOG_CATEGORY_MVC

#define LOG_CATEGORY_MVC   (SDL_LOG_CATEGORY_CUSTOM + 69)

Definition at line 35 of file Log.h.

◆ MVC_Assert

#define MVC_Assert (   cond,
  fmt,
  ... 
)
Value:
do { \
if (!(cond)) { \
SDL_LogCritical(LOG_CATEGORY_MVC, "%s::%d::%s: " fmt ": %s", __FILE__, __LINE__, __func__, ## __VA_ARGS__, SDL_GetError()); \
SDL_TriggerBreakpoint(); \
exit(EXIT_FAILURE); \
} \
} while (0)
#define LOG_CATEGORY_MVC
Definition Log.h:35

Asserts that cond is true, logging the SDL error and exiting on failure.

Unlike assert(3), this macro is never compiled out.

Definition at line 67 of file Log.h.

68 { \
69 if (!(cond)) { \
70 SDL_LogCritical(LOG_CATEGORY_MVC, "%s::%d::%s: " fmt ": %s", __FILE__, __LINE__, __func__, ## __VA_ARGS__, SDL_GetError()); \
71 SDL_TriggerBreakpoint(); \
72 exit(EXIT_FAILURE); \
73 } \
74 } while (0)

◆ MVC_LogCritical

#define MVC_LogCritical (   fmt,
  ... 
)     SDL_LogCritical(LOG_CATEGORY_MVC, "%s::%s: "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)

Definition at line 60 of file Log.h.

61 : "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)

◆ MVC_LogDebug

#define MVC_LogDebug (   fmt,
  ... 
)     SDL_LogDebug(LOG_CATEGORY_MVC, "%s::%s: "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)

Definition at line 48 of file Log.h.

49 : "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)

◆ MVC_LogEnabled

#define MVC_LogEnabled (   priority)     (SDL_GetLogPriority(LOG_CATEGORY_MVC) <= priority)

Definition at line 39 of file Log.h.

◆ MVC_LogError

#define MVC_LogError (   fmt,
  ... 
)     SDL_LogError(LOG_CATEGORY_MVC, "%s::%s: "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)

Definition at line 57 of file Log.h.

58 : "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)

◆ MVC_LogInfo

#define MVC_LogInfo (   fmt,
  ... 
)     SDL_LogInfo(LOG_CATEGORY_MVC, "%s::%s: "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)

Definition at line 51 of file Log.h.

52 : "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)

◆ MVC_LogMessage

#define MVC_LogMessage (   priority,
  fmt,
  ... 
)     SDL_LogMessage(LOG_CATEGORY_MVC, priority, "%s::%s "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)

Definition at line 42 of file Log.h.

◆ MVC_LogSetPriority

#define MVC_LogSetPriority (   priority)    SDL_SetLogPriority(LOG_CATEGORY_MVC, priority)

Definition at line 37 of file Log.h.

◆ MVC_LogVerbose

#define MVC_LogVerbose (   fmt,
  ... 
)     SDL_LogVerbose(LOG_CATEGORY_MVC, "%s::%s: "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)

Definition at line 45 of file Log.h.

46 : "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)

◆ MVC_LogWarn

#define MVC_LogWarn (   fmt,
  ... 
)     SDL_LogWarn(LOG_CATEGORY_MVC, "%s::%s: "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)

Definition at line 54 of file Log.h.

55 : "fmt, _Class()->def.name, __func__, ## __VA_ARGS__)