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