Debug
For in-house testing and better stack trace messages, we implemented a custom debug system that allows us to log messages at different levels of severity, and control the verbosity of the output.
This is especially useful during development to quickly identify issues and understand the flow of the program without overwhelming the console with too much information.
See below for the Level enum
public enum Level {
OFF(0),
ERROR(1),
WARN(2),
INFO(3),
DEBUG(4),
TRACE(5);
private final int priority;
Level(int priority) { this.priority = priority; }
public int getPriority() { return priority; }
}Usage
// Create a static logger instance
private static final Debug.Logger logger = Debug.getLogger("MyClass");
Outputs
logger.info("This is an info message.");Becomes:
[INFO] 2026-02-13T01:03:28.321905800Z game Main - Initializing game...Below is the String format we use:
String line = String.format("[%s] %s %s %s - %s", level.name(), ts, thread, tag, message);This includes the log level, timestamp, thread name, tag (usually the class name), and the message itself.
Last updated on