diff --git a/Engine.Core/Debug/FileLogger.cs b/Engine.Core/Debug/FileLogger.cs index b14a3d9..abadf56 100644 --- a/Engine.Core/Debug/FileLogger.cs +++ b/Engine.Core/Debug/FileLogger.cs @@ -20,10 +20,20 @@ public class FileLogger : LoggerBase private async Task WriteLogs() { - while (lineQueue.TryDequeue(out string? line)) - await File.AppendAllTextAsync(FilePath, $"{line}{Environment.NewLine}"); - - currentWriteTask = null; + try + { + while (lineQueue.TryDequeue(out string? line)) + await File.AppendAllTextAsync(FilePath, $"{line}{Environment.NewLine}"); + } + catch (Exception e) + { + ILogger.Shared.LogException(this, e); + throw; + } + finally + { + currentWriteTask = null; + } } public FileLogger(string filePath)