fix: file logger exception handling
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user