Skip to content

Commit 735efa9

Browse files
Marcin_OsadaMarcin_Osada
Marcin_Osada
authored and
Marcin_Osada
committed
Update naming and summaries
1 parent 4f1ae37 commit 735efa9

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/Serilog.Sinks.File/Sinks/File/FileLifecycleHooks.cs

+5-7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ namespace Serilog.Sinks.File
1919
{
2020
/// <summary>
2121
/// Enables hooking into log file lifecycle events.
22+
/// Hooks run synchronously and therefore may affect responsiveness of the application if long operations are performed.
2223
/// </summary>
2324
public abstract class FileLifecycleHooks
2425
{
@@ -37,13 +38,10 @@ public abstract class FileLifecycleHooks
3738
public virtual Stream OnFileOpened(Stream underlyingStream, Encoding encoding) => underlyingStream;
3839

3940
/// <summary>
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
41+
/// Called before an obsolete (rolling) log file is deleted.
42+
/// This can be used to copy old logs to an archive location or send to a backup server.
4243
/// </summary>
43-
/// <remarks>
44-
/// Executing long synchronous operation may affect responsiveness of application
45-
/// </remarks>
46-
/// <param name="fullPath">Log file full path</param>
47-
public virtual void OnFileRemoving(string fullPath) {}
44+
/// <param name="path">The full path to the file being deleted.</param>
45+
public virtual void OnFileDeleting(string path) {}
4846
}
4947
}

src/Serilog.Sinks.File/Sinks/File/RollingFileSink.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,7 @@ void ApplyRetentionPolicy(string currentFilePath)
199199
var fullPath = Path.Combine(_roller.LogFileDirectory, obsolete);
200200
try
201201
{
202-
if (_hooks != null) _hooks.OnFileRemoving(fullPath);
203-
202+
_hooks?.OnFileDeleting(fullPath);
204203
System.IO.File.Delete(fullPath);
205204
}
206205
catch (Exception ex)

0 commit comments

Comments
 (0)