Logging and Observability
Overview
ItemDrops is designed to follow the same logging architecture as other gameplay plugins (GridBuilding, WorldTime):
- Core logic uses a thin logging interface.
- Backend implementations rely on Chickensoft.Log.
- Godot (and other engine) specifics are owned by the host game.
This page describes how to integrate ItemDrops logging with your game and Godot.
Core Logging Contract
ItemDrops Core should expose a small logging interface (or adopt a shared one) such as:
public interface ILogger {
void Info(string message);
void Warn(string message);
void Error(string message, Exception? ex = null);
}
Design rules:
- No engine types in the interface.
- Minimal, focused API.
- Implementation can be swapped without modifying ItemDrops domain code.
Implementations in ItemDrops Core can:
- Use
Chickensoft.Logas the backend. - Use
TestWriterin unit tests for verifying log output.
Godot Integration (Game-Level)
For a Godot game that consumes ItemDrops:
-
Add logging dependencies
- Reference
Chickensoft.Log. - Optionally reference
Chickensoft.Log.Godot.
- Reference
-
Implement the ItemDrops logging interface
- Implement the interface in the game project.
- Internally, route messages to a configured
Chickensoft.Log.ILoginstance. - Configure writers (
TraceWriter,ConsoleWriter, Godot writers) as appropriate.
-
Register via DI/services
- Register your implementation so ItemDrops Core resolves it from DI.
-
Use Godot UI errors where needed
- Keep infrastructure logging in Chickensoft.Log.
- Use
GD.PushError/GD.PushWarningfrom Godot scripts to surface user-facing errors.
Recommended Godot Logger Backend
We recommend Chickensoft.Log.Godot as one option for adapting the ItemDrops logging interface to Godot:
- Attach Godot-specific writers to your
ILoginstance. - Keep the ItemDrops plugin itself unaware of engine details.
By following this pattern, ItemDrops remains portable across engines while still providing good observability in Godot-based games.