"Fixed" Issue with Filelogger, where program would crash if file could not be written
This commit is contained in:
parent
d6af014cb7
commit
b8bf7bdf30
@ -14,6 +14,13 @@ public class FileLogger : LoggerBase
|
||||
|
||||
protected override void Write(LogMessage logMessage)
|
||||
{
|
||||
File.AppendAllText(logFilePath, logMessage.ToString());
|
||||
try
|
||||
{
|
||||
File.AppendAllText(logFilePath, logMessage.ToString());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
stdOut?.WriteLine(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ namespace Logging;
|
||||
public abstract class LoggerBase : TextWriter
|
||||
{
|
||||
public override Encoding Encoding { get; }
|
||||
private TextWriter? stdOut { get; }
|
||||
protected TextWriter? stdOut { get; }
|
||||
|
||||
public LoggerBase(TextWriter? stdOut, Encoding? encoding = null)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user