Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b146f27

Browse files
authored
Merge pull request #62 from bender2k14/optimize_critical_section
Moved code out of critical section that isn't critical
2 parents e6f24c2 + 1ab6bb7 commit b146f27

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Serilog.Sinks.Console/Sinks/SystemConsole/ConsoleSink.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@ public void Emit(LogEvent logEvent)
5858
{
5959
var buffer = new StringWriter(new StringBuilder(DefaultWriteBufferCapacity));
6060
_formatter.Format(logEvent, buffer);
61+
var formattedLogEventText = buffer.ToString();
6162
lock (_syncRoot)
6263
{
63-
output.Write(buffer.ToString());
64+
output.Write(formattedLogEventText);
6465
output.Flush();
6566
}
6667
}

0 commit comments

Comments
 (0)