Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make FileQueue use GZip compression according to https://stackoverflow.com/a/37680109 #185

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion EnoCore/Logging/EnoLogMessageFileLoggerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public sealed class EnoLogMessageFileLoggerProvider : ILoggerProvider, ISupportE
public EnoLogMessageFileLoggerProvider(string tool, CancellationToken token)
{
this.tool = tool;
this.queue = new FileQueue($"../data/{tool}.log", token);
this.queue = new FileQueue($"../data/{tool}.log.gz", token);
}

public IExternalScopeProvider? ScopeProvider { get; internal set; }
Expand Down
3 changes: 2 additions & 1 deletion EnoCore/Logging/FileQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -16,7 +17,7 @@ public sealed class FileQueue : IDisposable

public FileQueue(string filename, CancellationToken cancelToken)
{
this.writer = new StreamWriter(filename);
this.writer = new StreamWriter(new GZipStream(new FileStream(filename, FileMode.Append), CompressionMode.Compress));
this.cancelToken = cancelToken;
Task.Run(this.WriterTask, cancelToken);
}
Expand Down
Loading