Use this checklist to add per-run debug logging to any GDevelop project.
Note:
- This checklist is for file logging (
FileSystem::LoadStringFromFileAsync/FileSystem::SaveStringToFileAsync). - It is separate from storage persistence flows (
Read...FromStorage,EcrireFichier...).
- Choose variable scope:
sceneorglobal. - Define variables:
Debug_Log_String(string)Debug_Log_FilePath(string)Debug_Log_RunId(string)
- Add folder
documents/logs/with.gitkeep. - Add ignore rules:
documents/logs/*!documents/logs/.gitkeep
- Create one logging event group (single writer).
- On startup, reset the three variables to empty.
- If
Debug_Log_Stringis set andDebug_Log_FilePathis empty:- create run id
- set filepath to
documents/logs/run_<runId>.txt
- If
Debug_Log_Stringis set:- prepend timestamp
- append/write to file
- clear
Debug_Log_String
- From any event, log by setting
Debug_Log_Stringto a concise message. - Use searchable tags (for example
[ROOM],[PLAYER],[CAMERA],[HAZARD]).
- Run preview twice and confirm two separate log files are created.
- Confirm each run file contains only that run's messages.
Taken from C:\GameDev\Dark-Ship-Codex\layouts\run.json.
Initialize log file:
{
"type": { "value": "FileSystem::SaveStringToFileAsync" },
"parameters": [
"\"Log started: \" + Debug_Log_RunId",
"Debug_Log_FilePath",
"Debug_Log_Success"
]
}Load then append:
{
"type": { "await": true, "value": "FileSystem::LoadStringFromFileAsync" },
"parameters": ["Temp_Log_Content", "Debug_Log_FilePath", "", ""]
}{
"type": { "value": "FileSystem::SaveStringToFileAsync" },
"parameters": [
"Temp_Log_Content + NewLine() + Debug_Log_String",
"Debug_Log_FilePath",
"Debug_Log_Success"
]
}- Referencing variables that were never declared.
- Writing from multiple event groups (duplicate or out-of-order lines).
- Forgetting to clear
Debug_Log_Stringafter write. - Committing generated log files.