BedeGaming / sinks-rollingfile

A serilog sink for rolling files based on size and time
Apache License 2.0
15 stars 20 forks source link

[Feature request] Implement retainedFileCountLimit as in RollingFile sink #8

Closed alex-y-su closed 8 years ago

alex-y-su commented 9 years ago

Hello, can you please add "retainedFileCountLimit" parameter as in original RollingFile sink? This parameter may be useful when I we wean log folder don't exceed some known value like 100MB, so my setup code could looks like config.WriteTo.RollingFileAlternate( fileName, fileSizeLimitBytes: 2097152, retainedFileCountLimit: 50);

rdavisunr commented 8 years ago

Was there ever any movement on this feature? I would like to see this incorporated.

EricMKaufman commented 8 years ago

+1 fileName as a parameter. Is there a way to do this today?

Wakusei commented 8 years ago

I also think retainedFileCountLimit is very useful for limiting the whole log file size.

Wakusei commented 8 years ago

Was there ever any movement on this feature?

I found it on a comment by ewilansky on a pull request. https://github.com/BedeGaming/sinks-rollingfile/pull/17

But the pull request itself isn't merged yet. If somebody added the function, I think it's not taken to the repository soon.

AndyWardle commented 8 years ago

Apologies for not getting to this sooner.

As of 2.0.6 RetainedFileCount is now available and it based (roughly) of the original RollingFileSink. The default value is set as null which keeps the functionality as is (no files get deleted on roll over).

ewilansky commented 8 years ago

That's great news. Thanks Andy!

Wakusei commented 8 years ago

Thanks a lot! I implemented a thread to delete log files by number, but now it's garbage :) I replace it with a new library.