All Projects → serilog-contrib → serilog-sinks-richtextbox

serilog-contrib / serilog-sinks-richtextbox

Licence: Apache-2.0 license
A Serilog sink that writes log events to a WPF RichTextBox control with colors and theme support

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to serilog-sinks-richtextbox

PathFinding
C# project. Realized a visualization of the pathfinding algorithms using Console (2D version), Windows Forms (2D version) and WPF (2D and 3D versions)
Stars: ✭ 18 (-62.5%)
Mutual labels:  console, wpf
InplaceEditBoxLib
WPF/MVVM control to implement a textbox on top of other elements like TreeViewItem or ListViewItem (use case: perform in place edit on top of a displayed text item)
Stars: ✭ 28 (-41.67%)
Mutual labels:  wpf, themes
Celestial.UIToolkit
A custom WPF toolkit which is inspired by a lot of the current design languages, including Microsoft's Fluent Design and Google's Material Design.
Stars: ✭ 32 (-33.33%)
Mutual labels:  wpf, themes
Csconsoleformat
.NET C# library for advanced formatting of console output [Apache]
Stars: ✭ 296 (+516.67%)
Mutual labels:  console, wpf
Simpleremote
Remote Administration Tools
Stars: ✭ 504 (+950%)
Mutual labels:  console, wpf
PoShLog
🔩 PoShLog is PowerShell cross-platform logging module. It allows you to log structured event data into console, file and much more places easily. It's built upon great C# logging library Serilog - https://serilog.net/
Stars: ✭ 108 (+125%)
Mutual labels:  serilog, sinks
Termtools
Customize your terminal using JavaScript. With themes, extra alias and functions, we combine the power from both JavaScript and Bash.
Stars: ✭ 42 (-12.5%)
Mutual labels:  console, themes
UIfied
A unified PowerShell DSL for UIs
Stars: ✭ 25 (-47.92%)
Mutual labels:  console, wpf
replay-csharp
An editable C# REPL (Read Eval Print Loop) powered by Roslyn and .NET Core
Stars: ✭ 69 (+43.75%)
Mutual labels:  wpf
ActiveDesktopPlus
A simple app that lets you pin windows to your desktop and use fullscreen programs and videos as interactive wallpapers.
Stars: ✭ 88 (+83.33%)
Mutual labels:  wpf
BlackPearl
Control Library for WPF
Stars: ✭ 17 (-64.58%)
Mutual labels:  wpf
color-console
A lightweight header-only C++ library to bring colors to your Windows console with a very-easy-to-use API.
Stars: ✭ 97 (+102.08%)
Mutual labels:  console
debug.js
Debugger of JavaScript, by JavaScript, for JavaScript
Stars: ✭ 19 (-60.42%)
Mutual labels:  console
DDNRuntime-examples
DDNRuntime(Delphi .NET Framework/.NET Core Runtime) example. DDNRuntime is a library for Delphi to call .net dll. Support the assembly written by c#, vb.net. Support importing .net dll to delphi, can create .net wrapper automatically.
Stars: ✭ 15 (-68.75%)
Mutual labels:  wpf
DevOpsExamples
A repo to show you how to use a private NuGet feed, such as Telerik, to restore packages in Azure DevOps, GitHub Actions, GitLab CI and AppCenter.
Stars: ✭ 16 (-66.67%)
Mutual labels:  wpf
WPFBot3000
Simple domain-specific language for a small subset of WPF, mainly for doing very limited (get the picture?) input forms in PowerShell
Stars: ✭ 38 (-20.83%)
Mutual labels:  wpf
Serilog.Sinks.Postgresql.Alternative
Serilog.Sinks.Postgresql.Alternative is a library to save logging information from https://github.com/serilog/serilog to https://www.postgresql.org/.
Stars: ✭ 29 (-39.58%)
Mutual labels:  serilog
dotnetCampus.Svg2XamlTool
Svg to WPF XAML file. 拖入 SVG 文件,即可转换为 XAML 可用代码
Stars: ✭ 14 (-70.83%)
Mutual labels:  wpf
theme-looper
A convenience package to switch themes in Emacs
Stars: ✭ 19 (-60.42%)
Mutual labels:  themes
cli
Aplus Framework CLI Library
Stars: ✭ 104 (+116.67%)
Mutual labels:  console
README.md
Serilog.Sinks.RichTextBox.Wpf

Serilog.Sinks.RichTextBox.Wpf

A Serilog sink that writes log events to any WPF RichTextBox control with coloring and custom theme support.

NuGet Version .NET .NET Core .NET Framework Stack Overflow

Screenshot of Serilog.Sinks.RichTextBox.Wpf in action

Give a Star!

If you like or are using this project please give it a star. Thanks!

Getting started 🚀

Install the Serilog.Sinks.RichTextBox.Wpf package from NuGet:

Install-Package Serilog.Sinks.RichTextBox.Wpf -Prerelease

Declare your RichTextBox control and give it a name that you can reference it from the code-behind. e.g.:

<Window (...)>
  <RichTextBox
      x:Name="MyRichTextBox"
      Background="Black"
      Foreground="LightGray"
      FontFamily="Cascadia Mono, Consolas, Courier New, monospace"
      VerticalScrollBarVisibility="Auto"
  />
</Window>

Then enable the sink using WriteTo.RichTextBox():

Log.Logger = new LoggerConfiguration()
    .WriteTo.RichTextBox(MyRichTextBox)
    .CreateLogger();

Log.Information("Hello, world!");

Log events will be written to the RichTextBox control:

[11:54:36 INF] Hello, world!

Themes

The sink will colorize output by default:

Screenshot of Serilog.Sinks.RichTextBox.Wpf in action

Themes can be specified when configuring the sink:

    .WriteTo.RichTextBox(MyRichTextBox, theme: RichTextBoxConsoleTheme.Grayscale)

The following built-in themes are available at this time:

Theme Description
RichTextBoxTheme.None No styling. Uses default styles applied to the RichTextBox control
RichTextBoxConsoleTheme.Literate Styled to replicate the default theme of Serilog.Sinks.Console; This is the default when no theme is specified
RichTextBoxConsoleTheme.Grayscale A theme using only shades of gray, white, and black
RichTextBoxConsoleTheme.Colored A theme based on the original Serilog.Sinks.ColoredConsole sink

Adding a new theme is straightforward; examples can be found in the RichTextBoxConsoleThemes class.

Output templates

The format of events to the RichTextBox can be modified using the outputTemplate configuration parameter:

    .WriteTo.RichTextBox(MyRichTextBox,
        outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}")

The default template, shown in the example above, uses built-in properties like Timestamp and Level. Properties from events, including those attached using enrichers, can also appear in the output template.

Release History

Click on the Releases tab on GitHub.


Copyright © 2021 C. Augusto Proiete & Contributors - Provided under the Apache License, Version 2.0.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].