serilog-contrib / Serilog.Enrichers.Sensitive

A Serilog LogEvent enricher that masks sensitive data
MIT License
111 stars 23 forks source link

Add Compiled option to regexes #1

Closed HuibertJan closed 4 years ago

HuibertJan commented 4 years ago

@sandermvanvliet I would add the Compiled option to your regexes. I included a Benchmark test program to quantify the differences.

HuibertJan commented 4 years ago

BenchmarkDotNet=v0.12.0, OS=Windows 10.0.18362 Intel Core i5-4590 CPU 3.30GHz (Haswell), 1 CPU, 4 logical and 4 physical cores .NET Core SDK=3.1.100 [Host] : .NET Core 3.1.0 (CoreCLR 4.700.19.56402, CoreFX 4.700.19.56404), X64 RyuJIT DefaultJob : .NET Core 3.1.0 (CoreCLR 4.700.19.56402, CoreFX 4.700.19.56404), X64 RyuJIT

Method Mean Error StdDev
EmailRegexReplace 10.995 ms 0.1071 ms 0.1002 ms
EmailRegexCompiledReplace 6.713 ms 0.1117 ms 0.1045 ms
IbanRegexReplace 8.256 ms 0.1571 ms 0.1809 ms
IbanRegexCompiledReplace 5.823 ms 0.0300 ms 0.0266 ms
HuibertJan commented 4 years ago

The appveyor build doesn't support netcoreapp3.1 yet. Do you want me to downgrade?

sandermvanvliet commented 4 years ago

Yeah would be a good idea to target netcoreapp2.2 because I'm using that for the demo and test projects already. And also AppVeyor...

sandermvanvliet commented 4 years ago

I'd add a global.json if it weren't for the issues that causes with being so specific on the SDK version

sandermvanvliet commented 4 years ago

@HuibertJan I had to push a fix for case-sensitive e-mail matching in the regex, so you'll have to rebase a bit.

HuibertJan commented 4 years ago

@sandermvanvliet It took a while before I was able to give it some more attention. It's rebased for your convenience.