feat: add logging feature with console, Godot and file outputs
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user