Skip to content

Commit 1af5cb9

Browse files
authored
Merge pull request #24 from vonhoff/Development
Various Improvements and Optimizations
2 parents 0e5162f + 91ac7a4 commit 1af5cb9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1473
-1140
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,8 @@ name: Build and Test
33
on:
44
pull_request:
55
branches: [ master ]
6-
paths:
7-
- '**'
8-
- '!**.md'
9-
- '!docs/**'
10-
- '!.github/**'
11-
- '.github/workflows/**'
126
push:
137
branches: [ master ]
14-
paths:
15-
- '**'
16-
- '!**.md'
17-
- '!docs/**'
18-
- '!.github/**'
19-
- '.github/workflows/**'
208

219
jobs:
2210
build-and-test:
@@ -50,18 +38,19 @@ jobs:
5038
reporttypes: 'Html;HtmlSummary'
5139
title: 'Code Coverage Report'
5240

41+
- name: Upload coverage report
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: coverage-report
45+
path: './coverage/report'
46+
continue-on-error: true
47+
5348
- name: Check coverage threshold
5449
run: |
5550
$coverage = Select-Xml -Path "./coverage/**/coverage.cobertura.xml" -XPath "//coverage/@line-rate" | Select-Object -ExpandProperty Node | Select-Object -ExpandProperty Value
5651
$coveragePercent = [math]::Round([double]$coverage * 100, 2)
5752
Write-Host "Current line coverage: $coveragePercent%"
5853
if ($coveragePercent -lt 75) {
59-
Write-Error "Code coverage ($coveragePercent%) is below the required threshold of 75%"
54+
Write-Error "Code coverage ($coveragePercent%) is below the required threshold of 70%"
6055
exit 1
61-
}
62-
63-
- name: Upload coverage report
64-
uses: actions/upload-artifact@v4
65-
with:
66-
name: coverage-report
67-
path: './coverage/report'
56+
}

CHANGES.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
## Release Notes - Serilog.Sinks.RichTextBox.WinForms.Colored v3.0.0
2+
3+
### Major Release - Breaking Changes
4+
5+
This major release focuses on performance optimization, UI stability, and streamlined configuration while simplifying the configuration API.
6+
7+
### Breaking Changes
8+
9+
- **Simplified Configuration Options**: Reduced configurable options to focus only on the most relevant and commonly used settings:
10+
- Removed `messageBatchSize` parameter (no longer needed)
11+
- Removed `messagePendingInterval` parameter (no longer needed)
12+
- Renamed `appliedTheme` parameter to `theme` for consistency
13+
14+
- **Theme System Overhaul**: Complete redesign of the theme system to align with the Serilog WPF sink. Previous theme names (`Dark`, `Light`, `DarkClassic`, `LightClassic`) have been replaced with new theme presets. All themes now include WCAG compliance with proper contrast ratio.
15+
16+
- **Enhanced Memory Management**: The `maxLogLines` parameter now has improved validation (1-512 range) with a default of 256 lines to ensure optimal performance. While not mandatory, proper configuration is recommended to prevent performance degradation from excessive log entries in the WinForms control.
17+
18+
### New Theme System
19+
20+
Available built-in themes:
21+
22+
| Theme | Description |
23+
|-----------------------------|------------------------------------------------------------------------------|
24+
| `ThemePresets.Literate` | Styled to replicate the default theme of Serilog.Sinks.Console (default) |
25+
| `ThemePresets.Grayscale` | A theme using only shades of gray, white, and black |
26+
| `ThemePresets.Colored` | A theme based on the original Serilog.Sinks.ColoredConsole sink |
27+
| `ThemePresets.Luminous` | A new light theme with high contrast for accessibility |
28+
29+
The themes based on the original sinks are slightly adjusted to be WCAG compliant, ensuring that the contrast ratio between text and background colors is at least 4.5:1. `Luminous` is a new theme specifically created for this sink.
30+
31+
### Bug Fixes
32+
33+
- **Fixed UI Freezing**: Resolved critical UI freeze issues caused by SystemEvents when using RichTextBox controls on background threads.
34+
35+
- **Fixed Auto-scroll on .NET Framework**: Corrected auto-scroll behavior that wasn't working properly on .NET Framework applications.
36+
37+
### Performance Improvements
38+
39+
- **Optimized Rendering Logic**: Removed the off-screen RichTextBox dependency and improved the rendering pipeline for better performance and reduced memory usage.
40+
41+
- **Streamlined Processing**: Removed unnecessary batching parameters to simplify internal processing logic.
42+
43+
### Migration Guide
44+
45+
Due to breaking changes, please update your existing configurations:
46+
47+
1. **Update Theme Names**: Replace old theme names with new equivalents:
48+
- `Dark` or `DarkClassic``ThemePresets.Colored` or `ThemePresets.Grayscale` or `ThemePresets.Literate`
49+
- `Light` or `LightClassic``ThemePresets.Luminous`
50+
51+
2. **Update Parameter Names**:
52+
- `appliedTheme``theme`
53+
- Remove `messageBatchSize` and `messagePendingInterval` parameters (no longer supported)
54+
55+
I recommend pairing this sink with a file sink for persistent logging storage, as it's not practical to have thousands of log entries displayed in a RichTextBox control.
56+
57+
### Recommended Configuration
58+
59+
```csharp
60+
Log.Logger = new LoggerConfiguration()
61+
.WriteTo.RichTextBox(richTextBox1,
62+
theme: ThemePresets.Literate,
63+
maxLogLines: 64) // Optional, defaults to 256
64+
.WriteTo.File("logs/app-.txt", rollingInterval: RollingInterval.Day) // Recommended for persistence
65+
.CreateLogger();
66+
```
67+
68+
### Full Changelog
69+
70+
- Reduced configurable options to only the most relevant ones (breaking change)
71+
- Renamed `appliedTheme` parameter to `theme` (breaking change)
72+
- Removed `messageBatchSize` and `messagePendingInterval` parameters (breaking change)
73+
- Completely redesigned theme system with new theme names and WCAG compliance (breaking change)
74+
- Added new `Luminous` theme for high contrast accessibility
75+
- Enhanced `maxLogLines` validation with 1-512 range limit
76+
- Fixed UI freeze caused by SystemEvents on background-thread RichTextBox
77+
- Optimized performance by removing the off-screen RichTextBox and improving rendering logic
78+
- Fixed auto-scroll issue on .NET Framework
79+
80+
### Resources
81+
82+
- [GitHub Repository](https://github.com/vonhoff/Serilog.Sinks.RichTextBox.WinForms.Colored)
83+
- [NuGet Package](https://www.nuget.org/packages/Serilog.Sinks.RichTextBox.WinForms.Colored)

Demo/Demo.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Serilog" Version="4.2.0"/>
14-
<PackageReference Include="System.Resources.Extensions" Version="7.0.0"/>
13+
<PackageReference Include="Serilog" Version="4.2.0" />
14+
<PackageReference Include="System.Resources.Extensions" Version="7.0.0" />
1515
</ItemGroup>
1616

1717
<ItemGroup>
18-
<ProjectReference Include="..\Serilog.Sinks.RichTextBox.WinForms.Colored\Serilog.Sinks.RichTextBox.WinForms.Colored.csproj"/>
18+
<ProjectReference Include="..\Serilog.Sinks.RichTextBox.WinForms.Colored\Serilog.Sinks.RichTextBox.WinForms.Colored.csproj" />
1919
</ItemGroup>
2020

2121
</Project>

0 commit comments

Comments
 (0)