Skip to content
Merged
Next Next commit
Extend LogEventBenchmark with ILogger.Log that includes EventId.
  • Loading branch information
andrii-babanin-sym committed Oct 31, 2024
commit d0dbbb1f45c3bd2bc2ea46d9c3fbadadb39cf951
12 changes: 12 additions & 0 deletions test/Serilog.Extensions.Logging.Benchmarks/LogEventBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ private class Person

readonly IMelLogger _melLogger;
readonly Person _bob, _alice;
readonly EventId _eventId = new EventId(1, "Test");

public LogEventBenchmark()
{
Expand Down Expand Up @@ -61,5 +62,16 @@ public void LogInformationScoped()
using (var scope = _melLogger.BeginScope("Hi {@User} from {$Me}", _bob, _alice))
_melLogger.LogInformation("Hi");
}

[Benchmark]
public void LogInformation_WithEventId()
{
this._melLogger.Log(
LogLevel.Information,
_eventId,
"Hi {@User} from {$Me}",
_bob,
_alice);
}
}
}