Skip to content

ZeeWeasel/LogDuck

Repository files navigation

Logo

LogDuck for Godot 4

License GitHub release badge GitHub code size in bytes

A straight-forward logging addon for Godot 4.x to centralize and manage your Debug output for your project.

Report BugRequest FeaturesDiscord Server

Installation

  • Download the .zip file and extract the LogDuck folder into your addons folder in your Godot Project.

    Inside of LogDuckSettings.gd are all settings to customize how you'd like LogDuck to behave. Every entry has a short explanation what it does. By default LogDuck will push warnings and errors automatically into the Debugger and rich output is enabled.

  • Alternatively, you can take the LogDuck.gd script and drag it into your project, and add it as an autoloaded script. Make sure to set it as high as possible in the Load Order, so it can be ready for other autoloaded scripts.

Note: You can adjust the desired class name either inside of plugin.gd or inside the autoloaded script list, if you prefer a different way to call the logger. (Log.d() instead of LogDuck.d() for example)

Version

Currently LogDuck supports Godot 4.0.1+ with GDScript. I have yet to look into making sure it plays along nicely with C# scripts. If you'd like to tackle that, feel free to contribute!

Using LogDuck

By default, LogDuck will output anything sent to LogDuck with d() w() and e() into the output / console, errors and warnings also into the Debugger if you are in the Editor. LogDuck, however, will not automatically catch any output sent to print(), printerr() or print_rich() calls. A careful Search and Replace of these functions with LogDuck.d, usually fixes this quickly.

If you need help with the setup, I will try my best to help out on the Discord server. If LogDuck is useful for you, please give me a shout on Twitter!

Current Features

  • Rich and plain text console formatting fully customizable with BBCode
  • Auto-detects names for Autoloaded and other GD scripts with class names
  • 3 Logging Levels: Debug, Warning, Error; toggleable
  • Logging functions handle up to 6 arguments (7 if the first isn't a String)
  • Toggle for last or full stack frame output in console per log level
  • Stack frame detail formats customizable as single line or full details
  • Warnings and errors pushable to Godot debugger (Editor only)
  • Option to pause game on logged errors (Editor/Debug only)
  • Option to block BBCode parsing in arguments, for outputs like Rich Text Labels / Chats
  • Instance numbering to differentiate logs in the editor output when testing multiple instances
  • Print system specs to console (automatically at startup or by calling method)

Future Work

  • Improved documentation (like this README.MD)
  • Adjust / Customize LogDuck via Project Settings Menus
  • Crash detection for previous session
  • Log File Handling
  • Output of images into the output when in print_rich mode
  • Being fully compatible with C# scripts

See the open issues for a full list of proposed features and known issues.

Contributing

Any contributions you make are greatly appreciated. I especially am looking to make this more robust and able to simplify debugging overall with the least amount of setup. Have a look at the planned features, to see if there is something you'd be interested in contributing!

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

Follow @zee_weasel on Twitter
Join Discord Server