-
Notifications
You must be signed in to change notification settings - Fork 4
Home
GoLogger is a simple yet flexible logging framework for Godot 4.3+, which captures and store game events(and data) into external .log files accessible by both developers and players to aid in development and maintenance of your projects. With minimal setup, it can be quickly integrated into any project to run in the background at all times or log specific events during testing. GoLogger utilizes 'categories' to create and sort entries into different files/folders.
Defining log entries are simple and only requires a string, which can include any data(that can be converted into a string). Formatting strings to include data can be done in multiple ways and is no different than normal. These 3 examples logs the same entry using different ways to concatenate strings and data:
Log.entry("Player's current health: " + str(current_health) + " / " + str(max_health), "game)
# Resulting entry into the category "game": [19:17:27] Player's current health: 74 / 100*You can add, rename and delete categories in the dock. You can also call individual entries with the `print_entry: bool` set to true to print entries to Output.*

GoLogger uses sessions to determine when the plugin is actively logging or not. Each session creates new log files for every category you've setup. Sessions are also global. Starting/stopping a session will start/stop logging all categories simultaneously. There are three main ways to start and stop sessions.
-
Using the
autostartsetting which is on by default. -
Hotkeys can perform the three main functions of the plugin - start
Ctrl + Shift + O, copy -Ctrl + Shift + Uand stop -Ctrl + Shift + P -
Calling the functions though code, allowing automation and flexibility.
This framework sets up all the logging background systems but requires you to create entries in your code-base manually. Meaning you are still required to create and add data to your log entries in order for anything to be logged. Despite this, it was designed with a "Set it and forget it" mindset, only requiring a simple setup and then write entries as during the course of the development of your project. As such creating log entries are made to be as simple as writing print() statements. See `How to use GoLogger" section for more info.
Categories can be used to divide entries up into different files. This helps to make the logs easier to parse and also doesn't fill logs with tons of entries from several systems in a matter of seconds. You can create, rename and delete categories in the dock panel. Take note of the integer in the top left corner of each category, as this integer is used when you create your entries to log the entry into the desired category. Log.entry(entry_string: String, category_index: int).
Allowing users to save copies of the logs of an active session into each category's respective saved_logs subfolder. When this is initiates, a text prompt is activated for you to specify a name of the copied log. This feature serves two key purposes:
- Prevent Deletion: Log files are automatically deleted when the file limit is reached. Saving a copy protects specific logs from being removed. You can also manually move any log file(s) out of the category folder will of course also prevent deletion.
-
Preserve Important Data: When using the Entry Count Limit + Overwrite Entries options to limit file size, older entries are deleted to make room for new ones. If a bug or unexpected event occurs during playtesting, you can use this feature to save the log without requiring you to stop and start the session or your game without the risk of overwriting the important log entries.
Pull requests and feature requests are welcome. Please report bugs and issues as well. If you simply don't like the look or user experience in any way, feedback is very helpful and you can open up a discussion here on Github.
