Skip to content

Feature/initial attempt #72

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

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f17cb52
initial serilog commit
Oct 10, 2018
fbeb47b
intial comments
Oct 10, 2018
28a52d6
test comment for reference
Oct 12, 2018
360de64
comments made around where to do compression
Oct 12, 2018
11f9662
comments on placement of compression
Oct 12, 2018
834b1b8
location to do compression o previous file
Oct 17, 2018
6a2884f
updates to comments on new method
Oct 17, 2018
1027296
file creation and deletion based off previous log
Oct 17, 2018
1e27cd8
basic zipping of previous log file at roll
Oct 17, 2018
62aca49
added parameters to rolling class, zip type set up in method
Oct 17, 2018
814e17f
paramters set up for compression and compression type
Oct 17, 2018
b2f32cf
GZIP method set up
Oct 17, 2018
67c1153
layout for gzip method set up
Oct 17, 2018
d58afda
gzip attempt
Oct 31, 2018
99f27a1
GZip basic functionality
Oct 31, 2018
9493330
check for uncompressd files and compress
Oct 31, 2018
c259969
remove compression bool
Oct 31, 2018
636b9f2
new Xunit file, error adding
Oct 31, 2018
fddd376
test written for checking compresison, need to delete extra created file
Nov 7, 2018
558fb65
log file still in use
Nov 7, 2018
64411b7
tests running, disposes log object now
Nov 7, 2018
91053dc
moved compression to new file
Nov 12, 2018
0be2657
initial commit of work on remote repo
Nov 12, 2018
14f3440
moved compression type into src
Nov 12, 2018
2d83c64
removed comments from methods
Nov 12, 2018
7489f97
moved compression tests into their own file
Nov 12, 2018
9a06121
added Assert that original .txt file is deleted in compression, roll
Nov 12, 2018
4b5ee31
completed initial PR comments, will resolve the rest on wednesday
Nov 12, 2018
a76b65b
updated for comments I did not have questions on / could implement now
Nov 16, 2018
4ccea1d
intial method to compress file in chunks for GZip
Nov 19, 2018
1325fa3
comments added to gzip method with current functionality
Nov 19, 2018
07b897a
updated gzip compress method to use chunking correctly
Nov 30, 2018
3b90756
add default value for compression type
Dec 3, 2018
5049097
replaced while loop with CopyTo() method
Dec 17, 2018
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 example/Sample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static void Main(string[] args)

// create a log'name'.txt file every minute
Log.Logger = new LoggerConfiguration()
.WriteTo.File("log.txt", rollingInterval: RollingInterval.Minute, compressionType: CompressionType.Zip)
.WriteTo.File("log.txt", rollingInterval: RollingInterval.Minute, compressionType: CompressionType.GZip)
.CreateLogger();

// two minute loop to create two log files
Expand Down
9 changes: 3 additions & 6 deletions src/Serilog.Sinks.File/Sinks/File/RollingFileSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,10 @@ public void GZipCompress(string logFile, string logDirectory)
{
using (var gzipStream = new System.IO.Compression.GZipStream(outputStream, System.IO.Compression.CompressionMode.Compress))
{
var buffer = new byte[1024];
int bytesRead;
int bufferSize = 1024;
var buffer = new byte[bufferSize];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think buffer is being used?


while ((bytesRead = inputStream.Read(buffer, 0, buffer.Length)) > 0)
{
gzipStream.Write(buffer, 0, bytesRead);
}
inputStream.CopyTo(gzipStream, bufferSize);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such a small buffer size is going to result in sub-par compression ratios - what's the purpose of overriding the default buffer size here? (I guess the default is 64K?)

}
}
}
Expand Down