Serilog.Sinks.WinForms 2.4.3

dotnet add package Serilog.Sinks.WinForms --version 2.4.3
NuGet\Install-Package Serilog.Sinks.WinForms -Version 2.4.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Serilog.Sinks.WinForms" Version="2.4.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Serilog.Sinks.WinForms --version 2.4.3
#r "nuget: Serilog.Sinks.WinForms, 2.4.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Serilog.Sinks.WinForms as a Cake Addin
#addin nuget:?package=Serilog.Sinks.WinForms&version=2.4.3

// Install Serilog.Sinks.WinForms as a Cake Tool
#tool nuget:?package=Serilog.Sinks.WinForms&version=2.4.3

Writes Serilog events to Windows Froms Application TextBox or Datagridview control from anywhere in your application.

Getting started

Install the Serilog.Sinks.WinForms package from NuGet:

Install-Package Serilog.Sinks.WinForms

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

Simple Text Formatted Log And Rich TextBox Log Control

SimpleLogTextBox or RichTextBoxLogControl 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 Configuration. SimpleLogTextBox 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();

JsonLogTextBox with custom Configuration. JsonLogTextBox accepts ITextFormatter

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

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

Log.Logger = new LoggerConfiguration()
                        .WriteToGridView()
                        .CreateLogger();
Log For Context

SimpleLogTextBox, RichTextBoxLogControl or JsonLogTextBox can be configured to display log for specific Context. All of the controls have property For Context which can be configured with namespace.classname for example TestApplication.Form2 you can find the sample here >> Sample

Note: Remember to configure Logger instance with Enrich.FromLogContext()

Save and Clear Logs

SimpleLogTextBox, RichTextBoxLogControl or JsonLogTextBox have two method available for saving log to file or clear the log from the log control. ClearLogs() AND SaveLogToFile()

Check the usage in the sample application here Sample

Sample Code

Find the sample running application here

Product Compatible and additional computed target framework versions.
.NET Framework net is compatible.  net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.4.3 5,649 9/2/2022
2.4.2 1,477 4/8/2022
2.4.1 811 4/8/2022
2.4.0 840 4/8/2022
2.3.1 3,373 5/27/2021
2.3.0 1,495 5/1/2021
2.2.6 1,100 3/2/2021
2.2.5 1,579 2/19/2021
2.2.4 723 2/18/2021
2.2.3 1,160 11/29/2020
2.2.2 818 11/18/2020
2.2.1 921 9/19/2020
2.2.0 854 9/12/2020
2.1.0 787 9/10/2020
2.0.0 828 9/3/2020
1.1.0 901 8/31/2020