From 1213d13b3b8c77ca5837ec64cbad774901acdef6 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 24 Aug 2019 23:11:40 +1000 Subject: [PATCH] compile the regex --- src/Serilog.Sinks.File/Sinks/File/PathRoller.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Serilog.Sinks.File/Sinks/File/PathRoller.cs b/src/Serilog.Sinks.File/Sinks/File/PathRoller.cs index 17c496b..79a6915 100644 --- a/src/Serilog.Sinks.File/Sinks/File/PathRoller.cs +++ b/src/Serilog.Sinks.File/Sinks/File/PathRoller.cs @@ -52,7 +52,8 @@ public PathRoller(string path, RollingInterval interval) "(?<" + PeriodMatchGroup + ">\\d{" + _periodFormat.Length + "})" + "(?<" + SequenceNumberMatchGroup + ">_[0-9]{3,}){0,1}" + Regex.Escape(_filenameSuffix) + - "$"); + "$", + RegexOptions.Compiled); DirectorySearchPattern = $"{_filenamePrefix}*{_filenameSuffix}"; }