Reorganise logging a little for development and output consistency.

This commit is contained in:
Adrian Conlon committed 2026-09-14 16:07:18 +01:00
1 parent a2ff55afea
commit 740947a90a
3 files changed
+13 -5

No files matched your search

+8 -2
View File
@@ -17,10 +17,16 @@
set => this._context = value;
}
public bool Debugging
{
get => this.Verbosity > ILogger.LogLevel.Information;
set => throw new NotImplementedException("Derived from logging verbosity");
}
public bool Strict
{
get => this.Verbosity < ILogger.LogLevel.Information;
set => throw new NotImplementedException("Strictness is derived from logging verbosity");
get => this.Debugging;
set => throw new NotImplementedException("Derived from logging verbosity");
}
public abstract void Log(string context, string message, ILogger.LogLevel level);
+4 -2
View File
@@ -2,7 +2,7 @@
{
public interface ILogger
{
enum LogLevel { Debugging, Information, Warning, Critical, }
enum LogLevel { Critical, Warning, Information, Debugging }
abstract string Context { get; set; }
@@ -10,13 +10,15 @@
abstract bool Strict { get; set; }
abstract bool Debugging { get; set; }
abstract void Log(string context, string message, LogLevel level);
void Log(string message, LogLevel level) => this.Log(this.Context, message, level);
void MaybeLog(string message, LogLevel level)
{
if (level >= this.Verbosity)
if (level <= this.Verbosity)
this.Log(message, level);
}
+1 -1
View File
@@ -6,7 +6,7 @@
public class Wrapper(ILogger.LogLevel logging = ILogger.LogLevel.Warning) : Device
{
private readonly ILogger _logger = new SdlLogger("Unnamed Game");
private readonly ILogger _logger = new ConsoleLogger("Unnamed Game");
private ILogger.LogLevel _verbosity = logging;