Skip to content

Commit

Permalink
Remove duplicate code (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
sungam3r authored Mar 13, 2024
1 parent 08c1f75 commit 6a819f1
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/Serilog.Sinks.RabbitMQ/Sinks/RabbitMQ/RabbitMQSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,7 @@ public Task EmitBatchAsync(IEnumerable<LogEvent> batch)
try
{
foreach (var logEvent in logEvents)
{
using var stream = _manager.GetStream();
using var sw = new StreamWriter(stream, _utf8NoBOM);
_formatter.Format(logEvent, sw);
sw.Flush();
_client.Publish(new ReadOnlyMemory<byte>(stream.GetBuffer(), 0, (int)stream.Length), _routeKeyFunction?.Invoke(logEvent));
}
Emit(logEvent);
}
catch (Exception exception)
{
Expand Down

0 comments on commit 6a819f1

Please sign in to comment.