feat: add logging feature with console, Godot and file outputs

This commit is contained in:
2026-08-23 20:20:41 +02:00
parent 5ee80df4c1
commit 988f1102f8
16 changed files with 205 additions and 16 deletions
+17 -11
View File
@@ -1,6 +1,7 @@
using Game.Features.Console.Application;
using Game.Features.Console.Contracts;
using Game.Features.Console.Infrastructure;
using Game.Features.Logging.Contracts;
using Game.Godot;
using Game.Godot.Extensions;
using Game.Godot.Mappings;
@@ -8,7 +9,7 @@ using Godot;
namespace Game.Features.Console.Godot;
public partial class ConsoleController : CanvasLayer
public partial class ConsoleController : CanvasLayer, ILogTarget
{
[Export] public LineEdit CommandInput;
[Export] public RichTextLabel OutputLog;
@@ -32,16 +33,6 @@ public partial class ConsoleController : CanvasLayer
_mouseMemento.RestoreCaptureMode();
}
}
public void AppendLine(string line)
{
OutputLog.AppendText(line + "\n");
}
public void UseCommandRegistry(ICommandRegistry registry)
{
_commandExecute = new CommandExecute(registry);
}
private void OnInputSubmitted(string text)
{
@@ -64,6 +55,21 @@ public partial class ConsoleController : CanvasLayer
}
}
private void AppendLine(string line)
{
OutputLog.AppendText(line + "\n");
}
public void UseCommandRegistry(ICommandRegistry registry)
{
_commandExecute = new CommandExecute(registry);
}
public void WriteLogLine(string logLine)
{
AppendLine(logLine);
}
public override void _Ready()
{
this.AssertRequiredExports();