Skip to content

Writes Serilog events to WPF TextBox control from anywhere in your application.

Notifications You must be signed in to change notification settings

umairsyed613/Serilog.Sinks.WPF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serilog.Sinks.WPF

NuGet version Build and Publish Nuget

Writes Serilog events to WPF TextBox control from anywhere in your application.

Getting started

Install the Serilog.Sinks.WPF package from NuGet:

Install-Package Serilog.Sinks.WPF

To configure the sink in C# code, call WriteToSimpleAndRichTextBox() or WriteToJsonTextBox() during logger configuration:

Simple Text Formatted Log

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();
Json Formatted Log

JsonLogTextBox can be used from visual studio toolbox once the package is added to the project.

Log.Logger = new LoggerConfiguration()
                        .WriteToJsonTextBox()
                        .CreateLogger();

Sample Code

Find the sample running application here

About

Writes Serilog events to WPF TextBox control from anywhere in your application.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages