File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed
src/Serilog.Sinks.File/Sinks/File Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -37,17 +37,13 @@ public abstract class FileLifecycleHooks
37
37
public virtual Stream OnFileOpened ( Stream underlyingStream , Encoding encoding ) => underlyingStream ;
38
38
39
39
/// <summary>
40
- /// Method called on log files that were marked as obsolete (old) and by default would be deleted.
41
- /// This can be used to move old logs to archive location or send to backup server
40
+ /// Method called on log files that were marked as obsolete (old) and would be deleted.
41
+ /// This can be used to copy old logs to archive location or send to backup server
42
42
/// </summary>
43
43
/// <remarks>
44
44
/// Executing long synchronous operation may affect responsiveness of application
45
45
/// </remarks>
46
46
/// <param name="fullPath">Log file full path</param>
47
- /// <returns>
48
- /// Return if Serilog should delete file.
49
- /// Warning: returning false and keeping file in same place will result in calling this method again in next scan for obsolete files
50
- /// </returns>
51
- public virtual bool OnFileRemoving ( string fullPath ) => true ;
47
+ public virtual void OnFileRemoving ( string fullPath ) { }
52
48
}
53
49
}
Original file line number Diff line number Diff line change @@ -199,8 +199,9 @@ void ApplyRetentionPolicy(string currentFilePath)
199
199
var fullPath = Path . Combine ( _roller . LogFileDirectory , obsolete ) ;
200
200
try
201
201
{
202
- if ( _hooks == null || _hooks . OnFileRemoving ( fullPath ) )
203
- System . IO . File . Delete ( fullPath ) ;
202
+ if ( _hooks != null ) _hooks . OnFileRemoving ( fullPath ) ;
203
+
204
+ System . IO . File . Delete ( fullPath ) ;
204
205
}
205
206
catch ( Exception ex )
206
207
{
You can’t perform that action at this time.
0 commit comments