Skip to content

Commit d01dcca

Browse files
committed
Update README.md
1 parent 835199d commit d01dcca

File tree

1 file changed

+46
-22
lines changed

1 file changed

+46
-22
lines changed

README.md

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
[![Latest version](https://img.shields.io/nuget/v/Serilog.Sinks.RichTextBox.WinForms.Colored.svg)](https://www.nuget.org/packages/Serilog.Sinks.RichTextBox.WinForms.Colored)
66
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
77

8-
A [Serilog](https://github.com/serilog/serilog) sink that writes log events to a [WinForms RichTextBox](https://docs.microsoft.com/en-us/dotnet/desktop/winforms/controls/richtextbox-control-overview-windows-forms) with support for coloring and custom themes.
8+
A [Serilog](https://github.com/serilog/serilog) sink that writes log events to
9+
a [WinForms RichTextBox](https://docs.microsoft.com/en-us/dotnet/desktop/winforms/controls/richtextbox-control-overview-windows-forms)
10+
with support for coloring and custom themes.
911

1012
![Screenshot of Serilog.Sinks.RichTextBox.WinForms.Colored in action](https://raw.githubusercontent.com/vonhoff/Serilog.Sinks.RichTextBox.WinForms.Colored/master/screenshot.png)
1113

@@ -16,7 +18,8 @@ A [Serilog](https://github.com/serilog/serilog) sink that writes log events to a
1618
- High-performance asynchronous processing
1719
- Line limit to control memory usage
1820
- Support for pretty-printing of JSON objects
19-
- WCAG compliant color schemes based on the [Serilog WPF RichTextBox](https://github.com/serilog-contrib/serilog-sinks-richtextbox) sink.
21+
- WCAG compliant color schemes based on
22+
the [Serilog WPF RichTextBox](https://github.com/serilog-contrib/serilog-sinks-richtextbox) sink.
2023

2124
## Getting Started
2225

@@ -51,36 +54,47 @@ Log.Logger = new LoggerConfiguration()
5154
Log.Information("Hello, world!");
5255
```
5356

54-
See the [Extension Method](Serilog.Sinks.RichTextBox.WinForms.Colored/RichTextBoxSinkLoggerConfigurationExtensions.cs) for more configuration options.
57+
See the [Extension Method](Serilog.Sinks.RichTextBox.WinForms.Colored/RichTextBoxSinkLoggerConfigurationExtensions.cs)
58+
for more configuration options.
5559

56-
## Themes
57-
58-
Available built-in themes:
59-
60-
| Theme | Description |
61-
|-----------------------------|------------------------------------------------------------------------------|
62-
| `ThemePresets.Literate` | Styled to replicate the default theme of Serilog.Sinks.Console __(default)__ |
63-
| `ThemePresets.Grayscale` | A theme using only shades of gray, white, and black |
64-
| `ThemePresets.Colored` | A theme based on the original Serilog.Sinks.ColoredConsole sink |
65-
| `ThemePresets.Luminous` | A light theme with high contrast for accessibility |
66-
67-
The themes based on the original sinks are slightly adjusted to be [WCAG compliant](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum), ensuring that the contrast ratio between text and background colors is at least 4.5:1.
60+
## Configuration Options
6861

69-
You can create your own custom themes by creating a new instance of the [Theme](Serilog.Sinks.RichTextBox.WinForms.Colored/Sinks/RichTextBoxForms/Themes/Theme.cs) class and passing it to the `RichTextBox` extension method. Look at the [existing themes](Serilog.Sinks.RichTextBox.WinForms.Colored/Sinks/RichTextBoxForms/Themes/ThemePresets.cs) for examples.
62+
| Option | Description | Default Value |
63+
|-------------------|------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------|
64+
| `theme` | The color theme applied when rendering individual message tokens. | `ThemePresets.Literate` |
65+
| `autoScroll` | When `true` (default) the target control scrolls automatically to the most recent log line. | `true` |
66+
| `maxLogLines` | Maximum number of log events retained in the in-memory circular buffer and rendered in the control. | `256` |
67+
| `outputTemplate` | Serilog output template that controls textual formatting of each log event. | `[${Timestamp:HH:mm:ss} ${Level:u3}] ${Message:lj}${NewLine}${Exception}` |
68+
| `formatProvider` | Optional culture-specific or custom formatting provider used when rendering scalar values; `null` for the invariant culture. | `CultureInfo.InvariantCulture` |
69+
| `prettyPrintJson` | When `true`, formats JSON values with indentation and line breaks for better readability. | `false` |
70+
| `spacesPerIndent` | Number of spaces per indentation level when pretty printing JSON. | `2` |
7071

71-
## FAQ
72+
## Themes
7273

73-
### Why is the package name so long?
74+
Available built-in themes:
7475

75-
Shorter alternatives were already reserved in NuGet. The descriptive name helps people find it more easily.
76+
| Theme | Description |
77+
|--------------------------|------------------------------------------------------------------------------|
78+
| `ThemePresets.Literate` | Styled to replicate the default theme of Serilog.Sinks.Console __(default)__ |
79+
| `ThemePresets.Grayscale` | A theme using only shades of gray, white, and black |
80+
| `ThemePresets.Colored` | A theme based on the original Serilog.Sinks.ColoredConsole sink |
81+
| `ThemePresets.Luminous` | A light theme with high contrast for accessibility |
7682

77-
### Why a WinForms RichTextBox and not WPF?
83+
The themes based on the original sinks are slightly adjusted to
84+
be [WCAG compliant](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum), ensuring that the contrast ratio
85+
between text and background colors is at least 4.5:1.
7886

79-
This sink is designed for WinForms apps to avoid pulling in the WPF framework and its dependencies.
87+
You can create your own custom themes by creating a new instance of
88+
the [Theme](Serilog.Sinks.RichTextBox.WinForms.Colored/Sinks/RichTextBoxForms/Themes/Theme.cs) class and passing it to
89+
the `RichTextBox` extension method. Look at
90+
the [existing themes](Serilog.Sinks.RichTextBox.WinForms.Colored/Sinks/RichTextBoxForms/Themes/ThemePresets.cs) for
91+
examples.
8092

8193
## Support the Project 💖
8294

83-
This project has been maintained since 2022 and is still under active development. If you find it useful, please consider supporting it. Your support will help keep the project alive and allow me to dedicate more time to making improvements. You can support it through:
95+
This project has been maintained since 2022 and is still under active development. If you find it useful, please
96+
consider supporting it. Your support will help keep the project alive and allow me to dedicate more time to making
97+
improvements. You can support it through:
8498

8599
* [GitHub Sponsors](https://github.com/sponsors/vonhoff)
86100
* [Ko-fi](https://ko-fi.com/vonhoff)
@@ -93,6 +107,16 @@ Contributions are welcome! Report issues, improve documentation, or submit pull
93107

94108
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
95109

110+
## Frequently Asked Questions
111+
112+
### Why is the package name so long?
113+
114+
Shorter alternatives were already reserved in NuGet. The descriptive name helps people find it more easily.
115+
116+
### Why a WinForms RichTextBox and not WPF?
117+
118+
This sink is designed for WinForms apps to avoid pulling in the WPF framework and its dependencies.
119+
96120
## License
97121

98122
Copyright © 2025 Simon Vonhoff & Contributors - Provided under the [Apache License, Version 2.0](LICENSE).

0 commit comments

Comments
 (0)