Monad Engine da02fba2
> Undercity Codex_
Loading...
Searching...
No Matches
Log.h File Reference

Console logging macros for all engine and game code. More...

#include <cstdarg>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <string>
#include "Constants.h"
#include "Types.h"
+ Include dependency graph for Log.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mnd::LogEntry
 

Namespaces

namespace  mnd
 

Macros

#define LOG_INFO(fmt, ...)   ::mnd::LogEmit(::mnd::LogLevel::Info, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
 
#define LOG_WARN(fmt, ...)   ::mnd::LogEmit(::mnd::LogLevel::Warn, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
 
#define LOG_ERROR(fmt, ...)   ::mnd::LogEmit(::mnd::LogLevel::Error, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
 
#define LOG_FATAL(fmt, ...)   do { ::mnd::LogEmit(::mnd::LogLevel::Fatal, __FILE__, __LINE__, fmt, ##__VA_ARGS__); std::abort(); } while (0)
 

Enumerations

enum class  mnd::LogLevel : u8 { mnd::Info , mnd::Warn , mnd::Error , mnd::Fatal }
 

Functions

const char * mnd::shortFile (const char *file)
 
void mnd::LogEmit (LogLevel level, const char *file, int line, const char *fmt,...) __attribute__((format(printf
 Emit a formatted log line to stdout/stderr and the ring buffer.
 
const std::deque< LogEntry > & mnd::LogGetEntries ()
 Snapshot of the in-memory log buffer (bounded ring).
 
void mnd::LogClear ()
 Clear the in-memory log buffer.
 

Detailed Description

Console logging macros for all engine and game code.

Four severity levels: INFO, WARN, ERROR, FATAL. Each macro prefixes the message with the module-relative source file path and line number, prints to stdout/stderr with ANSI colour, and pushes the formatted line into a ring buffer the in-game editor's Console panel reads.

Definition in file Log.h.

Macro Definition Documentation

◆ LOG_ERROR

#define LOG_ERROR (   fmt,
  ... 
)    ::mnd::LogEmit(::mnd::LogLevel::Error, __FILE__, __LINE__, fmt, ##__VA_ARGS__)

Definition at line 81 of file Log.h.

◆ LOG_FATAL

#define LOG_FATAL (   fmt,
  ... 
)    do { ::mnd::LogEmit(::mnd::LogLevel::Fatal, __FILE__, __LINE__, fmt, ##__VA_ARGS__); std::abort(); } while (0)

Definition at line 82 of file Log.h.

◆ LOG_INFO

#define LOG_INFO (   fmt,
  ... 
)    ::mnd::LogEmit(::mnd::LogLevel::Info, __FILE__, __LINE__, fmt, ##__VA_ARGS__)

Definition at line 79 of file Log.h.

◆ LOG_WARN

#define LOG_WARN (   fmt,
  ... 
)    ::mnd::LogEmit(::mnd::LogLevel::Warn, __FILE__, __LINE__, fmt, ##__VA_ARGS__)

Definition at line 80 of file Log.h.