2
0
Tranga/Logging/LoggerBase.cs

25 lines
519 B
C#
Raw Permalink Normal View History

2023-05-20 21:47:54 +02:00
using System.Text;
namespace Logging;
public abstract class LoggerBase : TextWriter
{
public override Encoding Encoding { get; }
public LoggerBase(Encoding? encoding = null)
2023-05-20 21:47:54 +02:00
{
this.Encoding = encoding ?? Encoding.ASCII;
}
public void Write(string caller, string? value)
2023-05-20 21:47:54 +02:00
{
if (value is null)
return;
LogMessage message = new (DateTime.Now, caller, value);
2023-05-20 21:47:54 +02:00
Write(message);
}
protected abstract void Write(LogMessage message);
}