Tranga-Website/Logging/FileLogger.cs

19 lines
467 B
C#
Raw Normal View History

2023-05-20 21:47:54 +02:00
using System.Text;
using System.Text.Json.Serialization;
namespace Logging;
public class FileLogger : LoggerBase
{
private string logFilePath { get; }
public FileLogger(string logFilePath, TextWriter? stdOut, Encoding? encoding = null) : base (stdOut, encoding)
{
this.logFilePath = logFilePath;
}
protected override void Write(LogMessage logMessage)
{
File.AppendAllText(logFilePath, logMessage.ToString());
}
}