You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
9
11
10
12

11
13
@@ -16,7 +18,8 @@ A [Serilog](https://github.com/serilog/serilog) sink that writes log events to a
16
18
- High-performance asynchronous processing
17
19
- Line limit to control memory usage
18
20
- 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.
20
23
21
24
## Getting Started
22
25
@@ -51,36 +54,47 @@ Log.Logger = new LoggerConfiguration()
51
54
Log.Information("Hello, world!");
52
55
```
53
56
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)
|`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 |
60
+
## Configuration Options
66
61
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.
|`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`|
68
71
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.
70
-
71
-
## FAQ
72
+
## Themes
72
73
73
-
### Why is the package name so long?
74
+
Available built-in themes:
74
75
75
-
Shorter alternatives were already reserved in NuGet. The descriptive name helps people find it more easily.
|`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 |
76
82
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.
78
86
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.
80
92
81
93
## Support the Project 💖
82
94
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
0 commit comments