Writes Serilog events to WPF TextBox control from anywhere in your application.
Install the Serilog.Sinks.WPF package from NuGet:
Install-Package Serilog.Sinks.WPFTo configure the sink in C# code, call WriteToSimpleAndRichTextBox() or WriteToJsonTextBox() during logger configuration:
SimpleLogTextBox can be used from visual studio toolbox once the package is added to the project.
Log.Logger = new LoggerConfiguration()
.WriteToSimpleAndRichTextBox()
.CreateLogger();SimpleLogTextBox or RichTextBoxLogControl with custom MessageTemplate. WriteToSimpleAndRichTextBox accepts ITextFormatter
Log.Logger = new LoggerConfiguration()
.WriteToSimpleAndRichTextBox(new MessageTemplateTextFormatter("{Timestamp} [{Level}] {Message} {Exception}"))
.CreateLogger();JsonLogTextBox can be used from visual studio toolbox once the package is added to the project.
Log.Logger = new LoggerConfiguration()
.WriteToJsonTextBox()
.CreateLogger();Find the sample running application here
