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
- Java
- Kotlin
// 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);
// Three severity levels, each with an optional tag.
Flixel.info("Spawner", "Spawned enemy at (100, 200)")
Flixel.warn("Physics", "Velocity clamped: ${obj.velocityX}")
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
- Java
- Kotlin
// In your game's constructor or create():
Flixel.log.startFileLogging();
// In your game's constructor or create():
Flixel.log.startFileLogging()
Log file location
| Context | Default location |
|---|---|
| Running from IDE | <project root>/logs/ |
| Running from a JAR | logs/ next to the JAR |
| Custom | Set 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()):
- Java
- Kotlin
Flixel.log.addLogListener(entry -> {
if (entry.level() == FlixelLogLevel.ERROR) {
crashReporter.submit(entry.tag(), entry.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
| Mode | What it prints |
|---|---|
SIMPLE | File location + line + message only. |
DETAILED | Level + timestamp + tag + message. Always used for file output. |
- Java
- Kotlin
Flixel.log.setLogMode(FlixelLogMode.DETAILED);
Flixel.log.logMode = FlixelLogMode.DETAILED