sotn-decomp/include/log.h
Luciano Ciccariello 1169fdc32a
Allow main roundtrip across different states (#804)
The most prominent change is the new macro which replaces the `DEBUGF`
for each stub, but that is the least interesting part. This allows to go
through the different steps `Game_Init`, `Game_NowLoading` and once it
finally lands into `Game_Play` it calls `func_800F298C`, which is our
new `main` function for testing stuff.
2023-11-22 22:52:10 +00:00

36 lines
840 B
C

#ifndef LOG_H
#define LOG_H
#include "common.h"
typedef enum {
LOG_LEVEL_D,
LOG_LEVEL_I,
LOG_LEVEL_W,
LOG_LEVEL_E,
} LOG_LEVEL;
#define NAMEOF(var) #var
#define NOT_IMPLEMENTED DEBUGF("not implemented")
#ifndef NO_LOGS
#define DEBUGF(...) _log(LOG_LEVEL_D, __FILE__, __LINE__, __func__, __VA_ARGS__)
#define INFOF(...) _log(LOG_LEVEL_I, __FILE__, __LINE__, __func__, __VA_ARGS__)
#define WARNF(...) _log(LOG_LEVEL_W, __FILE__, __LINE__, __func__, __VA_ARGS__)
#define ERRORF(...) _log(LOG_LEVEL_E, __FILE__, __LINE__, __func__, __VA_ARGS__)
void SetMinLogLevel(LOG_LEVEL level);
void _log(unsigned int level, const char* file, unsigned int line,
const char* func, const char* fmt, ...);
#else
#define DEBUGF(fmt, ...)
#define INFOF(fmt, ...)
#define WARNF(fmt, ...)
#define ERRORF(fmt, ...)
#endif
#endif