{"id":24463396,"url":"https://github.com/umairsyed613/Serilog.Sinks.WinForms","last_synced_at":"2025-10-01T21:30:56.451Z","repository":{"id":50936732,"uuid":"289016167","full_name":"umairsyed613/Serilog.Sinks.WinForms","owner":"umairsyed613","description":"Print Serilog logs from anywhere in you application into textbox or datagridview. windows forms","archived":false,"fork":false,"pushed_at":"2025-01-10T08:49:41.000Z","size":1317,"stargazers_count":23,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-20T03:08:42.367Z","etag":null,"topics":["datagridview","nuget","serilog","serilog-sink","serilog-windows-forms","textbox","windows-forms"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/umairsyed613.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":[],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2020-08-20T13:39:12.000Z","updated_at":"2025-01-10T08:49:45.000Z","dependencies_parsed_at":"2022-08-25T12:01:53.388Z","dependency_job_id":null,"html_url":"https://github.com/umairsyed613/Serilog.Sinks.WinForms","commit_stats":null,"previous_names":["umairsyed613/serilog.winforms"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umairsyed613%2FSerilog.Sinks.WinForms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umairsyed613%2FSerilog.Sinks.WinForms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umairsyed613%2FSerilog.Sinks.WinForms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umairsyed613%2FSerilog.Sinks.WinForms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/umairsyed613","download_url":"https://codeload.github.com/umairsyed613/Serilog.Sinks.WinForms/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234897339,"owners_count":18903673,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datagridview","nuget","serilog","serilog-sink","serilog-windows-forms","textbox","windows-forms"],"created_at":"2025-01-21T05:11:28.380Z","updated_at":"2025-10-01T21:30:56.445Z","avatar_url":"https://github.com/umairsyed613.png","language":"C#","funding_links":["https://www.buymeacoffee.com/umairsyed613"],"categories":[],"sub_categories":[],"readme":"[![\"Buy Me A Coffee\"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/umairsyed613)\n\n## Build Status\n\n![Build Status](https://travis-ci.org/umairsyed613/Serilog.Sinks.WinForms.svg?branch=master)\n\n# Serilog.Sinks.WinForms (.net framework \u003e= 4.6) (Windows Forms)\n\n[![NuGet version](https://badge.fury.io/nu/Serilog.Sinks.WinForms.png)](https://badge.fury.io/nu/Serilog.Sinks.WinForms) [![Nuget](https://img.shields.io/nuget/dt/Serilog.Sinks.WinForms)](https://www.nuget.org/packages/Serilog.Sinks.WinForms)\n\n# Serilog.Sinks.WinForms.Core (.net 6-8-9)\n\n[![NuGet version](https://badge.fury.io/nu/Serilog.Sinks.WinForms.Core.png)](https://badge.fury.io/nu/Serilog.Sinks.WinForms.Core) [![Nuget](https://img.shields.io/nuget/dt/Serilog.Sinks.WinForms.Core)](https://www.nuget.org/packages/Serilog.Sinks.WinForms.Core)\n\n\nWrites [Serilog](https://serilog.net) events to Windows Froms Application TextBox or Datagridview control from anywhere in your application.\n\n### Getting started\n\nInstall the [Serilog.Sinks.WinForms](https://www.nuget.org/packages/Serilog.Sinks.WinForms/) package from NuGet:\n\n```powershell\nInstall-Package Serilog.Sinks.WinForms\n```\n\nInstall the [Serilog.Sinks.WinForms.Core](https://www.nuget.org/packages/Serilog.Sinks.WinForms.Core/) package from NuGet:\n\n```powershell\nInstall-Package Serilog.Sinks.WinForms.Core\n```\n\nTo configure the sink in C# code, call `WriteToSimpleAndRichTextBox()` or `WriteToJsonTextBox()` or `WriteToGridView()` during logger configuration:\n\n##### Simple Text Formatted Log And Rich TextBox Log Control\n\nSimpleLogTextBox or RichTextBoxLogControl can be used from visual studio toolbox once the package is added to the project.\n\n```csharp\nLog.Logger = new LoggerConfiguration()\n                        .WriteToSimpleAndRichTextBox()\n                        .CreateLogger();\n```\n\nSimpleLogTextBox or RichTextBoxLogControl with custom Configuration. SimpleLogTextBox accepts [ITextFormatter](https://github.com/serilog/serilog/blob/dev/src/Serilog/Formatting/ITextFormatter.cs)\n\n```csharp\nLog.Logger = new LoggerConfiguration()\n                        .WriteToSimpleAndRichTextBox(new MessageTemplateTextFormatter(\"{Timestamp} [{Level}] {Message} {Exception}\"))\n                        .CreateLogger();\n```\n\n##### Json Formatted Log\n\nJsonLogTextBox can be used from visual studio toolbox once the package is added to the project.\n\n```csharp\nLog.Logger = new LoggerConfiguration()\n                        .WriteToJsonTextBox()\n                        .CreateLogger();\n```\n\nJsonLogTextBox with custom Configuration. JsonLogTextBox accepts [ITextFormatter](https://github.com/serilog/serilog/blob/dev/src/Serilog/Formatting/ITextFormatter.cs)\n\n```csharp\nLog.Logger = new LoggerConfiguration()\n                        .WriteToJsonTextBox(new JsonFormatter())\n                        .CreateLogger();\n```\n\n##### Datagridview Log\n\nGridLog can be used from visual studio toolbox once the package is added to the project.\n\n```csharp\nLog.Logger = new LoggerConfiguration()\n                        .WriteToGridView()\n                        .CreateLogger();\n```\n\n#### Log For Context\n\nSimpleLogTextBox, RichTextBoxLogControl or JsonLogTextBox can be configured to display log for specific ***Context***.\nAll of the controls have property **For Context** which can be configured with ***namespace.classname*** for example ***TestApplication.Form2*** you can find the sample here \u003e\u003e [Sample](https://github.com/umairsyed613/Serilog.Sinks.WinForms/blob/master/src/Sample/TestApplication/Form2.cs)\n\n**Note:** Remember to configure Logger instance with ***Enrich.FromLogContext()***\n\n\n#### Save and Clear Logs\nSimpleLogTextBox, RichTextBoxLogControl or JsonLogTextBox have two method available for saving log to file or clear the log from the log control.\n***ClearLogs()*** AND ***SaveLogToFile()***\n\nCheck the usage in sample application here [Sample](https://github.com/umairsyed613/Serilog.Sinks.WinForms/blob/master/src/Sample/TestApplication/Form2.cs)\n\n\n### Sample Code\n\nFind the sample running application [here](https://github.com/umairsyed613/Serilog.Sinks.WinForms/tree/master/Sample/TestApplication/)\n\n![Sample](https://github.com/umairsyed613/Serilog.Sinks.WinForms/blob/main/SampleVideo.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumairsyed613%2FSerilog.Sinks.WinForms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fumairsyed613%2FSerilog.Sinks.WinForms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumairsyed613%2FSerilog.Sinks.WinForms/lists"}