Added a pretty-printing debug logger

A new feature has been added to the codebase, which is a pretty-printing debug logger. This logger colorizes printed data based on datatype and handles nested data structures such as Arrays and Dictionaries. It also prefixes logs with the callsite's source file for easy tracking. The logger supports opt-in to pretty printing via duck-typing by implementing a `to_printable()` method on the object.
This commit is contained in:
Dan 2024-06-01 12:58:17 +01:00
parent 3fa6393643
commit 052dc00039
3 changed files with 501 additions and 0 deletions

14
addons/log/plugin.cfg Normal file
View file

@ -0,0 +1,14 @@
[plugin]
name="Log.gd"
description="A pretty-printing debug logger.
Log.pr(\"some str\", some_object)
- Colorizes printed data based on datatype
- Handles nested data structures (Arrays and Dictionaries)
- Prefixes logs with the callsite's source file
- Opt-in to pretty printing via duck-typing (implement a `to_printable()` method on the object)"
author="Russell Matney"
version="v0.0.5"
script="plugin.gd"