This commit is contained in:
1 parent
4081b5949d
commit
2909500bb8
14 files changed
+342
-114
No files matched your search
@@ -36,7 +36,7 @@ namespace EonaCat.LogStack.Server
|
||||
_maxLogDirectorySize = maxLogDirectorySize;
|
||||
}
|
||||
|
||||
protected virtual Task ProcessLogAsync(string logData)
|
||||
protected virtual async Task ProcessLogAsync(string logData)
|
||||
{
|
||||
string logsRootDirectory = "logs";
|
||||
|
||||
@@ -67,7 +67,12 @@ namespace EonaCat.LogStack.Server
|
||||
// After processing log, check directory size and clean up if needed
|
||||
CleanUpOldLogs();
|
||||
|
||||
return File.AppendAllTextAsync(logFilePath, logData + Environment.NewLine);
|
||||
using (var stream = new FileStream(logFilePath, FileMode.Append, FileAccess.Write, FileShare.Read | FileShare.Delete, 4096, FileOptions.Asynchronous))
|
||||
using (var writer = new StreamWriter(stream))
|
||||
{
|
||||
await writer.WriteLineAsync(logData).ConfigureAwait(false);
|
||||
await writer.FlushAsync().ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void CleanUpOldLogs()
|
||||
|
||||
Reference in new issue
Block a user