Add logging functionality to GamePresenter and implement GodotLogger
This commit is contained in:
35
Code/Services/GodotLogger.cs
Normal file
35
Code/Services/GodotLogger.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using GameCore.Logging.Interfaces;
|
||||
using Godot;
|
||||
|
||||
namespace CryptonymThunder.Code.Services;
|
||||
|
||||
public class GodotLogger : ILogger
|
||||
{
|
||||
public void Debug(string message)
|
||||
{
|
||||
GD.Print($"[DEBUG] {message}");
|
||||
}
|
||||
|
||||
public void Info(string message)
|
||||
{
|
||||
GD.Print($"[INFO] {message}");
|
||||
}
|
||||
|
||||
public void Warn(string message)
|
||||
{
|
||||
GD.PushWarning(message);
|
||||
}
|
||||
|
||||
public void Error(string message, Exception ex = null)
|
||||
{
|
||||
if (ex != null)
|
||||
{
|
||||
GD.PrintErr($"[ERROR] {message} Exception: {ex}");
|
||||
}
|
||||
else
|
||||
{
|
||||
GD.PrintErr($"[ERROR] {message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
1
Code/Services/GodotLogger.cs.uid
Normal file
1
Code/Services/GodotLogger.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bu65qwpq5f8ba
|
||||
Reference in New Issue
Block a user