Skip to main content

Logging

FlixelLogger is the framework's structured logging system. You write to it through the static helpers on Flixel, and it delivers each entry to both the console and (optionally) a rolling log file. The debugger's Log window listens to it in real time.


Writing log messages

// Three severity levels, each with an optional tag.
Flixel.info("Spawner", "Spawned enemy at (100, 200)");
Flixel.warn("Physics", "Velocity clamped: " + obj.getVelocityX());
Flixel.error("SaveSystem", "Failed to write save file", exception);

The tag is free-form text. Use it as a module or subsystem identifier so you can filter messages in the Log window (or grep in a log file) when debugging a specific system.


Enabling file logging

// In your game's constructor or create():
Flixel.log.startFileLogging();

Log file location

ContextDefault location
Running from IDE<project root>/logs/
Running from a JARlogs/ next to the JAR
CustomSet via Flixel.log.setLogsFolder("path/to/logs")

Custom log listeners

Attach a listener to receive every log entry as a FlixelLogEntry (a record exposing level(), tag(), and message()):

Flixel.log.addLogListener(entry -> {
if (entry.level() == FlixelLogLevel.ERROR) {
crashReporter.submit(entry.tag(), entry.message());
}
});

Listeners receive entries even in RELEASE builds where the debug overlay is absent. This makes them the right hook for crash reporting, telemetry, or an in-game developer console of your own design.


Log modes

ModeWhat it prints
SIMPLEFile location + line + message only.
DETAILEDLevel + timestamp + tag + message. Always used for file output.
Flixel.log.setLogMode(FlixelLogMode.DETAILED);