serilog-sinks-file icon indicating copy to clipboard operation
serilog-sinks-file copied to clipboard

RollingInterval more extendable

Open blowin opened this issue 3 years ago • 0 comments

Replace enum with class, and replace extension with method. This will allow you to more flexibly customize the spacing and format.

In my project, I need to use files with a specific name, but the library does not allow me to specify this. Therefore, I had to abandon this library and use a self-written solution.

I suggest the following solution:

public interface IRollingInterval
{
   string Format { get; }

   DateTime? CurrentCheckpoint(DateTime instant);

   DateTime? NextCheckpoint(DateTime instant);
}

With implementation: InfiniteRollingInterval, YearRollingInterval etc

This solution allow easy extend behaviour. To avoid backward compatibility issues, you can make a separate interface overload and mark the enum as obsolete.

blowin avatar Jun 17 '21 12:06 blowin