fix: file logger exception handling

This commit is contained in:
2026-04-18 17:52:21 +03:00
parent 6df3df1c3b
commit ce3e46948f

View File

@@ -20,10 +20,20 @@ public class FileLogger : LoggerBase
private async Task WriteLogs() private async Task WriteLogs()
{ {
while (lineQueue.TryDequeue(out string? line)) try
await File.AppendAllTextAsync(FilePath, $"{line}{Environment.NewLine}"); {
while (lineQueue.TryDequeue(out string? line))
currentWriteTask = null; await File.AppendAllTextAsync(FilePath, $"{line}{Environment.NewLine}");
}
catch (Exception e)
{
ILogger.Shared.LogException(this, e);
throw;
}
finally
{
currentWriteTask = null;
}
} }
public FileLogger(string filePath) public FileLogger(string filePath)