{"id":29031809,"url":"https://github.com/serilog-contrib/serilog-sinks-notepad","last_synced_at":"2025-06-26T10:05:35.106Z","repository":{"id":39451082,"uuid":"164962348","full_name":"serilog-contrib/serilog-sinks-notepad","owner":"serilog-contrib","description":"A Serilog sink that writes log events to Notepad as text or JSON","archived":false,"fork":false,"pushed_at":"2025-03-20T00:26:05.000Z","size":262,"stargazers_count":69,"open_issues_count":4,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-09T06:51:18.461Z","etag":null,"topics":["augustoproiete","hacktoberfest","logging","notepad","serilog","serilog-sink","serilog-sinks-notepad","sink"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serilog-contrib.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"augustoproiete"}},"created_at":"2019-01-10T00:50:55.000Z","updated_at":"2025-05-14T12:23:30.000Z","dependencies_parsed_at":"2023-09-25T01:30:08.454Z","dependency_job_id":"53716a07-6923-471e-bfe4-df2fae39d877","html_url":"https://github.com/serilog-contrib/serilog-sinks-notepad","commit_stats":{"total_commits":80,"total_committers":5,"mean_commits":16.0,"dds":0.35,"last_synced_commit":"3d5a8252ed673a16552ef1953a863ab612f23dd8"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/serilog-contrib/serilog-sinks-notepad","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serilog-contrib%2Fserilog-sinks-notepad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serilog-contrib%2Fserilog-sinks-notepad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serilog-contrib%2Fserilog-sinks-notepad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serilog-contrib%2Fserilog-sinks-notepad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serilog-contrib","download_url":"https://codeload.github.com/serilog-contrib/serilog-sinks-notepad/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serilog-contrib%2Fserilog-sinks-notepad/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262044450,"owners_count":23249752,"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":["augustoproiete","hacktoberfest","logging","notepad","serilog","serilog-sink","serilog-sinks-notepad","sink"],"created_at":"2025-06-26T10:05:34.664Z","updated_at":"2025-06-26T10:05:35.095Z","avatar_url":"https://github.com/serilog-contrib.png","language":"C#","funding_links":["https://github.com/sponsors/augustoproiete"],"categories":[],"sub_categories":[],"readme":"| README.md |\n|:---|\n\n\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"assets/serilog-sink-nuget.png\" alt=\"Serilog.Sinks.Notepad\" width=\"100\" /\u003e\n\n\u003c/div\u003e\n\n\u003ch1 align=\"center\"\u003eSerilog.Sinks.Notepad\u003c/h1\u003e\n\u003cdiv align=\"center\"\u003e\n\nA [Serilog](https://serilog.net) sink that writes log events to Notepad (_Yes, you've read it right!_). Simply open Notepad and immediately start receiving logs from your application, without even touching the filesystem.\n\n[![NuGet Version](http://img.shields.io/nuget/v/Serilog.Sinks.Notepad.svg?style=flat)](https://www.nuget.org/packages/Serilog.Sinks.Notepad) [![Stack Overflow](https://img.shields.io/badge/stack%20overflow-serilog-orange.svg)](http://stackoverflow.com/questions/tagged/serilog)\n\n![Screenshot of Serilog.Sinks.Notepad in action](assets/serilog-sinks-notepad-screenshot.png)\n\n\u003c/div\u003e\n\n`Serilog.Sinks.Notepad` writes messages to the most recent `notepad.exe` started on current user's session, by default. This behavior can be changed in the sink configuration.\n\nThe default output is plain text; JSON formatting can be plugged in using a package such as [_Serilog.Formatting.Compact_](https://github.com/serilog/serilog-formatting-compact).\n\n## Give a Star! :star:\n\nIf you like or are using this project please give it a star. Thanks!\n\n## Getting started :rocket:\n\nInstall the [Serilog.Sinks.Notepad](https://www.nuget.org/packages/Serilog.Sinks.Notepad) package from NuGet:\n\n```powershell\nInstall-Package Serilog.Sinks.Notepad\n```\n\nTo configure the sink in C# code, call `WriteTo.Notepad()` during logger configuration:\n\n```csharp\nLog.Logger = new LoggerConfiguration()\n    .WriteTo.Notepad()\n    .CreateLogger();\n\nLog.Information(\"Hello, world!\");\n\nLog.CloseAndFlush();\n```\n\nOpen Notepad, and you should see the logs appear in that Notepad window you've just opened. By default, `Serilog.Sinks.Notepad` writes messages to the most recent `notepad.exe` started by the user. This behavior can be changed in the sink configuration.\n\n## Background\n\nI created this sink just for fun, after reading [this comment on Reddit](https://www.reddit.com/r/programming/comments/gnazif/ray_tracing_in_notepadexe_at_30_fps/fr8uy2l/):\n\n[![Screenshot of Serilog.Sinks.Notepad in action](assets/reddit-comment-note-ad-as-debug-console.png)](https://www.reddit.com/r/programming/comments/gnazif/ray_tracing_in_notepadexe_at_30_fps/fr8uy2l/)\n\nI thought it was a clever idea to be able to simply open a Notepad instance and immediately start receiving logs from your application, and I can imagine this actually being useful for troubleshooting issues with applications.\n\n## Configuration\n\n### Output templates\n\nThe format of events written to Notepad can be modified using the `outputTemplate` configuration parameter:\n\n```csharp\n    .WriteTo.Notepad(\n        outputTemplate: \"[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}\")\n```\n\nThe default template, shown in the example above, uses built-in properties like `Timestamp` and `Level`. Properties from events, including those attached using [enrichers](https://github.com/serilog/serilog/wiki/Enrichment), can also appear in the output template.\n\n### JSON output\n\nThe sink can write JSON  output instead of plain text. `CompactJsonFormatter` or `RenderedCompactJsonFormatter` from [Serilog.Formatting.Compact](https://github.com/serilog/serilog-formatting-compact) is recommended:\n\n```powershell\nInstall-Package Serilog.Formatting.Compact\n```\n\nPass a formatter to the `Notepad()` configuration method:\n\n```csharp\n    .WriteTo.Notepad(new RenderedCompactJsonFormatter())\n```\n\n### XML `\u003cappSettings\u003e` configuration\n\nTo use the Notepad sink with the [Serilog.Settings.AppSettings](https://github.com/serilog/serilog-settings-appsettings) package, first install that package if you haven't already done so:\n\n```powershell\nInstall-Package Serilog.Settings.AppSettings\n```\n\nInstead of configuring the logger in code, call `ReadFrom.AppSettings()`:\n\n```csharp\nLog.Logger = new LoggerConfiguration()\n    .ReadFrom.AppSettings()\n    .CreateLogger();\n```\n\nIn your application's `App.config` or `Web.config` file, specify the Notepad sink assembly under the `\u003cappSettings\u003e` node:\n\n```xml\n\u003cconfiguration\u003e\n  \u003cappSettings\u003e\n    \u003cadd key=\"serilog:using:Notepad\" value=\"Serilog.Sinks.Notepad\" /\u003e\n    \u003cadd key=\"serilog:write-to:Notepad\" /\u003e\n```\n\nTo configure the Notepad sink and include the `SourceContext` in the output, change your `App.config`/`Web.config` to:\n```xml\n\u003cconfiguration\u003e\n  \u003cappSettings\u003e\n    \u003cadd key=\"serilog:using:Notepad\" value=\"Serilog.Sinks.Notepad\" /\u003e\n    \u003cadd key=\"serilog:write-to:Notepad.outputTemplate\" value=\"[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} \u0026lt;s:{SourceContext}\u0026gt;{NewLine}{Exception}\" /\u003e\n```\n\n### JSON `appsettings.json` configuration\n\nTo use the Notepad sink with _Microsoft.Extensions.Configuration_, for example with ASP.NET Core or .NET Core, use the [Serilog.Settings.Configuration](https://github.com/serilog/serilog-settings-configuration) package. First install that package if you have not already done so:\n\n```powershell\nInstall-Package Serilog.Settings.Configuration\n```\n\nInstead of configuring the sink directly in code, call `ReadFrom.Configuration()`:\n\n```csharp\nvar configuration = new ConfigurationBuilder()\n    .AddJsonFile(\"appsettings.json\")\n    .Build();\n\nLog.Logger = new LoggerConfiguration()\n    .ReadFrom.Configuration(configuration)\n    .CreateLogger();\n```\n\nIn your `appsettings.json` file, under the `Serilog` node, :\n```json\n{\n  \"Serilog\": {\n    \"WriteTo\": [{\"Name\": \"Notepad\"}]\n  }\n}\n```\n\nTo configure the Notepad sink and include the `SourceContext` in the output, change your `appsettings.json` to:\n```json\n{\n  \"Serilog\": {\n    \"WriteTo\": [\n      {\n        \"Name\": \"Notepad\",\n        \"Args\": {\n          \"outputTemplate\": \"[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} \u003cs:{SourceContext}\u003e{NewLine}{Exception}\"\n        }\n      }\n    ]\n  }\n}\n```\n\n## Debugging and Diagnostics\n\nWhen Serilog is not behaving as you expect, this may be caused by an internal exception or configuration issue. Serilog writes simple diagnostic messages to [SelfLog](https://github.com/serilog/serilog/wiki/Debugging-and-Diagnostics#selflog), which can be forwarded to Notepad, using the `NotepadWindow` static class:\n\n```csharp\nSerilog.Debugging.SelfLog.Enable(s =\u003e NotepadWindow.WriteLine($\"Internal Error with Serilog: {s}\"));\n```\n\nThe above will attempt to write Serilog's diagnostic messages to the most recent Notepad process open in the user's session.\n\n## Release History\n\nClick on the [Releases](https://github.com/serilog-contrib/serilog-sinks-notepad/releases) tab on GitHub.\n\n---\n\n_Copyright \u0026copy; 2020-2023 C. Augusto Proiete \u0026 Contributors - Provided under the [Apache License, Version 2.0](LICENSE)._\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserilog-contrib%2Fserilog-sinks-notepad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserilog-contrib%2Fserilog-sinks-notepad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserilog-contrib%2Fserilog-sinks-notepad/lists"}