Skip to content

Commit

Permalink
Always output entire log messages (manigandham#11)
Browse files Browse the repository at this point in the history
This commit ensures that log messages are printed to the console's
stdout in their entirety by flushing the internal buffer of the
`StreamWriter` after every write operation.
  • Loading branch information
ecampidoglio committed Oct 19, 2023
1 parent 40c39c9 commit 15e4c57
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Serilog.Sinks.FastConsole/FastConsoleSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ namespace Serilog.Sinks.FastConsole;

public class FastConsoleSink : ILogEventSink, IDisposable
{
private static readonly StreamWriter _consoleWriter = new(Console.OpenStandardOutput(), Console.OutputEncoding, 4096, true);
private static readonly StreamWriter _consoleWriter =
new(Console.OpenStandardOutput(), Console.OutputEncoding, 4096, true)
{
AutoFlush = true
};
private readonly StringWriter _bufferWriter = new();
private readonly Channel<LogEvent?> _queue;
private readonly Task _worker;
Expand Down

0 comments on commit 15e4c57

Please sign in to comment.