serilog-sinks-file
serilog-sinks-file copied to clipboard
RollingInterval more extendable
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.