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)
36
36
{
37
37
return logLevel switch
38
38
{
39
- LogLevel . None or LogLevel . Critical => LogEventLevel . Fatal ,
39
+ LogLevel . None => LevelAlias . Off ,
40
+ LogLevel . Critical => LogEventLevel . Fatal ,
40
41
LogLevel . Error => LogEventLevel . Error ,
41
42
LogLevel . Warning => LogEventLevel . Warning ,
42
43
LogLevel . Information => LogEventLevel . Information ,
Original file line number Diff line number Diff line change 23
23
namespace Serilog . Extensions . Logging . Benchmarks ;
24
24
25
25
[ MemoryDiagnoser ]
26
- public class LogEventConstructionBenchmark
26
+ public class EventIdCapturingBenchmark
27
27
{
28
28
readonly IMelLogger _melLogger ;
29
29
readonly ILogger _serilogContextualLogger ;
30
30
readonly CapturingSink _sink ;
31
31
const int LowId = 10 , HighId = 101 ;
32
32
const string Template = "This is an event" ;
33
33
34
- public LogEventConstructionBenchmark ( )
34
+ public EventIdCapturingBenchmark ( )
35
35
{
36
36
_sink = new CapturingSink ( ) ;
37
37
var underlyingLogger = new LoggerConfiguration ( ) . WriteTo . Sink ( _sink ) . CreateLogger ( ) ;
38
- _serilogContextualLogger = underlyingLogger . ForContext < LogEventConstructionBenchmark > ( ) ;
38
+ _serilogContextualLogger = underlyingLogger . ForContext < EventIdCapturingBenchmark > ( ) ;
39
39
_melLogger = new SerilogLoggerProvider ( underlyingLogger ) . CreateLogger ( GetType ( ) . FullName ! ) ;
40
40
}
41
41
@@ -68,7 +68,7 @@ public void Verify()
68
68
[ Fact ]
69
69
public void Benchmark ( )
70
70
{
71
- BenchmarkRunner . Run < LogEventConstructionBenchmark > ( ) ;
71
+ BenchmarkRunner . Run < EventIdCapturingBenchmark > ( ) ;
72
72
}
73
73
74
74
[ Benchmark ( Baseline = true ) ]
You can’t perform that action at this time.
0 commit comments