Updated
This commit is contained in:
@@ -58,19 +58,19 @@ public class Logger
|
||||
{
|
||||
var logFileName = logName + ".log";
|
||||
|
||||
await using var fS = new FileStream(Path.Combine(ConvertToAbsolutePath(LogFolder), logFileName), FileMode.Open,
|
||||
FileAccess.Read, FileShare.ReadWrite, 64 * 1024, true);
|
||||
await using var fileStream = new FileStream(Path.Combine(ConvertToAbsolutePath(LogFolder), logFileName), FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete, 64 * 1024, true);
|
||||
|
||||
var response = context.Response;
|
||||
|
||||
response.ContentType = "text/plain";
|
||||
response.Headers.ContentDisposition = "attachment;filename=" + logFileName;
|
||||
|
||||
if (limit > fS.Length || limit < 1)
|
||||
if (limit > fileStream.Length || limit < 1)
|
||||
{
|
||||
limit = fS.Length;
|
||||
limit = fileStream.Length;
|
||||
}
|
||||
|
||||
var oFS = new OffsetStream(fS, 0, limit);
|
||||
var oFS = new OffsetStream(fileStream, 0, limit);
|
||||
var request = context.Request;
|
||||
Stream stream;
|
||||
|
||||
@@ -109,7 +109,7 @@ public class Logger
|
||||
{
|
||||
await oFS.CopyToAsync(stream).ConfigureAwait(false);
|
||||
|
||||
if (fS.Length > limit)
|
||||
if (fileStream.Length > limit)
|
||||
{
|
||||
await stream.WriteAsync("\r\n####___TRUNCATED___####"u8.ToArray()).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user