30 const char *ptr = std::strstr(file,
"monad-engine/");
37 const char *
module = nullptr;
38 if (std::strncmp(ptr,
"engine/", 7) == 0) {
40 }
else if (std::strncmp(ptr,
"game/", 5) == 0) {
46 const char *last_slash = std::strrchr(ptr,
'/');
47 const char *base_name = (last_slash !=
nullptr) ? last_slash + 1 : ptr;
49 std::snprintf(buffer,
sizeof(buffer),
"%s%s", module, base_name);
68void LogEmit(
LogLevel level,
const char *file,
int line,
const char *fmt, ...)
69 __attribute__((format(printf, 4, 5)));
79#define LOG_INFO(fmt, ...) ::mnd::LogEmit(::mnd::LogLevel::Info, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
80#define LOG_WARN(fmt, ...) ::mnd::LogEmit(::mnd::LogLevel::Warn, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
81#define LOG_ERROR(fmt, ...) ::mnd::LogEmit(::mnd::LogLevel::Error, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
82#define LOG_FATAL(fmt, ...) do { ::mnd::LogEmit(::mnd::LogLevel::Fatal, __FILE__, __LINE__, fmt, ##__VA_ARGS__); std::abort(); } while (0)
Engine-wide compile-time tunables and ANSI colour codes.
constexpr mnd::i32 kLogPrefixBufSize
Engine-wide primitive type aliases and GLM math imports.
uint8_t u8
Unsigned 8-bit integer.
void LogClear()
Clear the in-memory log buffer.
const std::deque< LogEntry > & LogGetEntries()
Snapshot of the in-memory log buffer (bounded ring).
const char * shortFile(const char *file)
void LogEmit(LogLevel level, const char *file, int line, const char *fmt,...)
Emit a formatted log line to stdout/stderr and the ring buffer.