From 11b2cfa087f5de09b97eb42fb219f563886f6d40 Mon Sep 17 00:00:00 2001 From: Joel Stålnacke Date: Sun, 13 Oct 2024 14:32:14 +0300 Subject: Add libdjup logging --- client/Root.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'client/Root.cs') diff --git a/client/Root.cs b/client/Root.cs index e39a485..b565083 100644 --- a/client/Root.cs +++ b/client/Root.cs @@ -13,7 +13,19 @@ public partial class Root : Node2D public unsafe override void _Ready() { RenderingServer.SetDefaultClearColor(Colors.LightGray); - + LibDjup.log_set_output((level, source, line, msg) => { + string level_name = level switch + { + LogLevel.Trace => "trace", + LogLevel.Debug => "debug", + LogLevel.Info => "info", + LogLevel.Warn => "warn", + LogLevel.Error => "error", + LogLevel.Fatal => "fatal" + }; + GD.Print($"libdjup {source}:{line} {level_name.PadLeft(5, ' ')}: {msg}"); + }); + native_world = LibDjup.world_create(); for (int i = 0; i < balls.Length; i++) { -- cgit v1.2.3