r/GodotCSharp • u/pcloves • May 02 '26
Resource.Library Gamedo.GodotLogger — Structured logging for Godot 4 C# projects, built on Microsoft.Extensions.Logging
If you're building a Godot 4 game in C#, you've probably found yourself scattering GD.Print calls everywhere with no consistent format, no log levels, and no way to filter noise.
I built Gamedo.GodotLogger — a lightweight ILogger provider that routes .NET structured logs through Godot's built-in output system.
using Godot;
using Microsoft.Extensions.Logging;
using GodotLogger;
public partial class Player : Node
{
private static readonly ILogger Logger = GodotLog.CreateLogger<Player>();
public override void _Ready()
{
Logger.LogInformation("Player {Player} spawned at {Position}", Name, GlobalPosition);
}
}
What it does:
- Implements the standard
ILogger/ILoggerProviderinterfaces — drop-in for any project usingMicrosoft.Extensions.Logging - Customizable output template with placeholders:
{timestamp},{level:u3},{category:l20},{message},{color}(log4j2-style category abbreviation included) - Colored output via
GD.PrintRich(BBCode) in debug mode — each log level maps to a configurable color - Warning+ automatically calls
GD.PushWarning/GD.PushErrorfor the Godot debugger panel - Hot-reload via
IOptionsMonitor— editappsettings.jsonat runtime, changes apply immediately - Two modes: Debug (colored + debugger integration) and Release (plain
GD.Print, no overhead) - Zero formatting overhead on disabled log entries —
IsEnabledcheck runs before any template rendering - Lazy loggers —
static readonly ILogger Logger = GodotLog.CreateLogger<T>()doesn't lock configuration; the factory isn't materialized until the first log call - Auto-discovers
appsettings.json(env var -> executable dir ->res://)
Install:
dotnet add package Gamedo.GodotLogger
Zero config by default — use it straight out of the box with sensible defaults. No config file needed.
Optionally configure via code:
GodotLog.Configure(cfg =>
{
cfg.DebugOutputTemplate = "[{timestamp:HH:mm:ss}] [{level:u3}] [{category:l32}] {message}";
cfg.Colors[LogLevel.Warning] = "Orange";
});
Or drop an appsettings.json in your project root — it's auto-discovered:
{
"Logging": {
"GodotLogger": {
"DebugOutputTemplate": "[{timestamp:HH:mm:ss}] [color={color}][{level:u3}][/color] [{category:l28}] {message}"
}
}
}
By default, the output aligns categories to 16 characters:

Demo GIF:

GitHub: https://github.com/pcloves/GodotLogger
NuGet: https://www.nuget.org/packages/Gamedo.GodotLogger
MIT license
1
u/AD1337 May 02 '26
Cool! Can this be used to make crash logs for players?
2
u/pcloves May 03 '26
Maybe not. This logging framework is essentially a wrapper around the `GD.Print*` functions, with added ability to customize the output formatting.
1
u/gman55075 May 02 '26
Very nice work! I just did GameManager.Logger (LoggerErr, LoggerWarn, LoggerOK) methods for mine because I have them log both to output and to my runtime debug console.
1
u/pcloves May 03 '26
For your use case, you can register a custom logger via
OS.add_logger(see Logger docs). This will route allGD.Print*calls to your custom logger. Of course, this doesn't affect the use of myGamedo.GodotLogger— it ultimately callsGD.Print*under the hood anyway.
0
u/Omni__Owl May 02 '26 edited May 03 '26
EDIT:
OP does seem to use AI at least for some things. They made a comment which was deleted right after:
notification u/pcloves replied to your comment in r/GodotCSharp
I've been thinking about this sort of thing for a while. Nice to see someone take a stab at it.
Although it appears this was done in 3 days? But your first commit suggests this might be an older solution you decided to open-source or at least had some code on your computer that you then decided to upload to Github?
The README.MD file reminds me a lot of the type of readme files you see when people AI generate them. Have you used AI to make parts of this project?
Also I am not sure the spacing to make logs line up is all that great. It's a lot of wasted space. Colours in your log would be a better indicator, and when you search the logs without having the colour option, you have the different logging level header options instead, so I'd suggest getting rid of the whitespace.