Repository navigation
Getting Started
Simply installing GoLogger will not log any entries or data. This plugin is a framework for you to define your own log entries in your code as you develop your project. Entries are simple strings, meaning any data that can be converted to a string by using str(data) can be added to an entry.
When creating a log entry, you only need to create a string and concatenate any data you need. The only need to be mindful of specifying the category_index which depends on the categories you use. If you for example want to log the current time in your game and the players current position in two separate entries when you've loaded your game(also assuming you have the default categories). See the Example Usage of the main functions paragraph for real world examples of how entries can be made.
Without defining a category_index when creating log entries(i.e. Log.entry("This is a log entry.")). Entries are logged into the category with the index 0.
GoLogger will create directories for each category in the dock's "category" tab. By default, a "game" and a "player" category is added for you but you can add, remove or rename them to fit your needs. The top-left number of each category is the category_index which you use whenever you create log entries in your code. When your project runs, folders are created with the name of each category within the base_directory and ones a session is started. A .log file is created for each category and is stored in the category's folder.

Notes:
- Locked categories are deleted when using the Reset button. The lock button just disables the text field, apply and delete buttons.
-
Folders for categories created by the plugin aren't deleted when you delete a category in the dock. This is to prevent accidental deletion of log files. It's best to open the directory using the "Open" button and manually delete the corresponding folder of any deleted category.
!*
Concatenating data and strings can be done though many ways, and creating strings for log entries are no different. Use your preferred method, but below are some examples of how to use the main methods of this framework.
# General use, simply starts the session. Hotkey: Ctrl + Shift + O
Log.start_session()
# Starts session 1.2 seconds after the call. Requires the use of 'await'.
await Log.start_session(1.2)
# No category_index defined > defaults to category 0("game" category by default).
Log.entry(str("Current game time: ", time_of_day))
# Resulting entry : [19:17:27] Current game time: 16.30
# Logs into category 1("player" category by default). 3 ways to format the same string.
Log.entry("Current Player health: " + str(current_health) + "/" + str(max_health), 1)
Log.entry(str("Current Player health: ", current_health, "/", max_health), 1)
Log.entry(str("Current Player health: %s/%s" % current_health, max_health), 1)
# Resulting entry: [19:17:27] Current Player health: 74/100
# Copy session anytime the "player_death" signal is emitted. Hotkey: Ctrl + Shift + U
func _on_player_death() -> void:
Log.save_copy()
# Stops an active session. Hotkey: Ctrl + Shift + P
Log.stop_session() The index of every category is shown in the "Categories" tab of the dock at the top left of each category.