File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
src/Serilog.Extensions.Logging/Extensions/Logging
test/Serilog.Extensions.Logging.Benchmarks Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,8 @@ public static LogEventLevel ToSerilogLevel(LogLevel logLevel)
3636 {
3737 return logLevel switch
3838 {
39- LogLevel . None or LogLevel . Critical => LogEventLevel . Fatal ,
39+ LogLevel . None => LevelAlias . Off ,
40+ LogLevel . Critical => LogEventLevel . Fatal ,
4041 LogLevel . Error => LogEventLevel . Error ,
4142 LogLevel . Warning => LogEventLevel . Warning ,
4243 LogLevel . Information => LogEventLevel . Information ,
Original file line number Diff line number Diff line change 2323namespace Serilog . Extensions . Logging . Benchmarks ;
2424
2525[ MemoryDiagnoser ]
26- public class LogEventConstructionBenchmark
26+ public class EventIdCapturingBenchmark
2727{
2828 readonly IMelLogger _melLogger ;
2929 readonly ILogger _serilogContextualLogger ;
3030 readonly CapturingSink _sink ;
3131 const int LowId = 10 , HighId = 101 ;
3232 const string Template = "This is an event" ;
3333
34- public LogEventConstructionBenchmark ( )
34+ public EventIdCapturingBenchmark ( )
3535 {
3636 _sink = new CapturingSink ( ) ;
3737 var underlyingLogger = new LoggerConfiguration ( ) . WriteTo . Sink ( _sink ) . CreateLogger ( ) ;
38- _serilogContextualLogger = underlyingLogger . ForContext < LogEventConstructionBenchmark > ( ) ;
38+ _serilogContextualLogger = underlyingLogger . ForContext < EventIdCapturingBenchmark > ( ) ;
3939 _melLogger = new SerilogLoggerProvider ( underlyingLogger ) . CreateLogger ( GetType ( ) . FullName ! ) ;
4040 }
4141
@@ -68,7 +68,7 @@ public void Verify()
6868 [ Fact ]
6969 public void Benchmark ( )
7070 {
71- BenchmarkRunner . Run < LogEventConstructionBenchmark > ( ) ;
71+ BenchmarkRunner . Run < EventIdCapturingBenchmark > ( ) ;
7272 }
7373
7474 [ Benchmark ( Baseline = true ) ]
You can’t perform that action at this time.
0 commit comments