mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-10-24 14:05:42 +00:00
Reorganise logging a little for development and output consistency.
This commit is contained in:
1 parent
a2ff55afea
commit
740947a90a
3 files changed
+13
-5
No files matched your search
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user