@@ -116,6 +116,39 @@ public static LoggerConfiguration RollingFileAlternate(
116
116
return configuration . Sink ( sink , minimumLevel ) ;
117
117
}
118
118
119
+ /// <summary>
120
+ /// Creates an alternative implementation of the rolling file sink with
121
+ /// an overload to pass an ITextFormatter.
122
+ /// </summary>
123
+ /// <param name="configuration"><see cref="LoggerSinkConfiguration"/></param>
124
+ /// <param name="formatter">Formatter to control how events are rendered into the file. To control
125
+ /// plain text formatting, use the overload that accepts an output template instead.</param>
126
+ /// <param name="logDirectory">The names of the directory to be logged</param>
127
+ /// <param name="logFilePrefix">The prefix for the log file name.</param>
128
+ /// <param name="minimumLevel">Minimum <see cref="LogLevel"/></param>
129
+ /// <param name="fileSizeLimitBytes">The size files should grow up to (default 2MB)</param>
130
+ /// <param name="retainedFileCountLimit">The maximum number of log files that will be retained,
131
+ /// including the current log file. The default is null which is unlimited.</param>
132
+ /// <returns></returns>
133
+ public static LoggerConfiguration RollingFileAlternate (
134
+ this LoggerSinkConfiguration configuration ,
135
+ ITextFormatter formatter ,
136
+ string logDirectory ,
137
+ string logFilePrefix ,
138
+ LogEventLevel minimumLevel = LevelAlias . Minimum ,
139
+ long ? fileSizeLimitBytes = null ,
140
+ int ? retainedFileCountLimit = null )
141
+ {
142
+ if ( configuration == null )
143
+ {
144
+ throw new ArgumentNullException ( "configuration" ) ;
145
+ }
146
+
147
+ var sink = new AlternateRollingFileSink ( logDirectory , formatter , fileSizeLimitBytes ?? TwoMegabytes ,
148
+ retainedFileCountLimit , logFilePrefix : logFilePrefix ) ;
149
+ return configuration . Sink ( sink , minimumLevel ) ;
150
+ }
151
+
119
152
/// <summary>
120
153
/// Creates an hourly rolling file sink that rolls files every hour.
121
154
/// </summary>
0 commit comments