Repository navigation
How file counts and sizes are managed
Despite .log files taking minimal storage space, generating an endless amount of files is never a good idea. Therefore, GoLogger has an adjustable file count limit setting that limits the number of .log files allowed in the category folders. By default, this limit is set to 10 and will overwrite the log file with the oldest date- and timestamp. Moving a .log file out of the folder saves it from this overwrite action.

It's possible to turn this off by setting the value to 0 but it is NOT recommended!
A potential pitfall to consider when logging large/growing data is how Godot's FileAccess API handles file writing. The FileAccess.WRITE mode truncates(deletes) the file's content, meaning we can't simply append new entries to a file. The plugin first reads the file and stores each entry in an array which are then re-entered sequentially before appending a new entry. This process can cause performance issues as the entry count grows, thereby creating larger arrays.
It is therefore vital to put limitations in place, which GoLogger offers a couple of options. In the settings tab of the dock, you can find Limit Method, each method has its own Action to determine the action taken once the condition of the method is fullfilled.
As the name suggests, the number of entries are counted and is used together with the settings Entry Count Action and entry cap. The Entry Count Action is triggered once the entry count exceeds the set entry cap. Actions available for this method:
-
Overwrite entriesremoves the oldest entries as new ones are written. This is the safest and objectively better option to use. However, this potentially deletes important logs. So be mindful that you should either stop the session manually, copy the session or quit your game to prevent any entry loss. -
Stop sessionwill of course stop the session once the cap is hit. Requires you to start the session either manually or through code to log again. -
Restart sessionrestarts a session, creating a new log file.
A timer is started alongside sessions and the Action is triggered upon timeout. The session timer has uses outside of solving the file size issue. For example, if you don't want to log at all times, only when testing or stress testing that requires you to log during certain times. The session timer features signals that allows you to sync up the session and a test with session_timer_started and session_timer_stopped. Actions available for this method:
-
Stop sessionwill stops sessions on session timer timeout. Requires you to start the session either manually or through code to log again. -
Restart sessionrestarts sessions, creating a new log file.
You can also use both Entry Count Limit and Session Timer simultaneously!
You can also choose to use none of the Limit Method options. This can be useful if you don't have sessions running in the background at all times. For example, if you use GoLogger only when you want to test a specific feature or system and you're manually stopping and starting the sessions as you need them. This is NOT RECOMMENDED unless you're aware of the problems that can occur. Use at your own risk!