russmatney
Log.gd, a gdscript pretty-printer
Log.gd provides static functions for printing colorized output. Theseare intended as drop-in replacements for `print(...)`.- `Log.pr(...)` - pretty print args in one line- `Log.prn(...)` - the same, but with newlines- `Log.warn(...)` - pretty-print without newlines AND push a warning via `push_warning`- `Log.err(...)` - pretty-print without newlines AND push a error via `push_error`This is very useful while developing, because your printed output is much more readable.Colorized outputThe colorized output really shines when showing nested data structures (`Arrays` and `Dictionaries`), but it's also very useful for other gdscript primitives, like `Vectors`, `NodePaths`, and `StringNames`. Support for more types is easily added, feel free to create an issue!Call-site prefixesLog's print functions will prefix the output with the name of the script the log comes from, including the line number.This call-site feature is really nice! Unfortunately it can only be used during development - it depends on `get_stack()`, which is not available in production builds or at `@tool` script time.Opt-in via duck-typingYou can opt-in to pretty-printing in your classes by implementing `to_pretty()`, which Log will pickup via duck-typing.```gdscriptclass_name ExampleClassfunc to_pretty(): return {val=12}func _ready():_ Log.pr(self) # colorized `{"val": 12}````Full docs here: https://russmatney.github.io/log.gd/#/