refactor: replace custom ILogger with Serilog + Microsoft.Extensions.Logging#85
Draft
mcpolo99 wants to merge 7 commits into
Draft
Conversation
added 6 commits
June 11, 2026 20:34
Separate progress reporting (Progress, EndProgress, Finish) from logging into a new IProgressReporter interface. This is the first step toward replacing the custom ILogger with Microsoft.Extensions.Logging + Serilog. - Add IProgressReporter interface and NullProgressReporter - Remove Progress, EndProgress, Finish from ILogger and all implementations - Remove dead BeginModule/EndModule from NullLogger - Add ProgressReporter property to ConfuserParameters and ConfuserContext - Replace PackerLogger (full ILogger decorator) with PackerProgressReporter - Update all WithProgress call sites to use context.ProgressReporter - Fix MSBuildLogger.Finish bug (was setting HasError=false on failure) - Seal NullLogger class
Add Microsoft.Extensions.Logging.Abstractions to Confuser.Core (netstandard2.0 compatible) and a MelLoggerAdapter that bridges M.E.L ILogger to the internal Confuser.Core.ILogger interface. This allows callers to pass a standard M.E.L logger (backed by Serilog or any other provider) into ConfuserEngine without changing any internal code yet.
Wire up Serilog as the logging provider in the CLI via Microsoft.Extensions.Logging and MelLoggerAdapter. - Add Serilog, Serilog.Extensions.Logging, Serilog.Sinks.Console - Delete custom ConsoleLogger — Serilog handles all console output - Add --verbose (-v, -vv, -vvv) and --quiet (-q) CLI flags - Default: Information level; -q: Warning; -v: Debug; -vv+: Verbose
Wire up Serilog in the WPF GUI via a custom FlowDocumentSink that renders color-coded log output to the protection log panel. - Add Serilog and Serilog.Extensions.Logging to ConfuserEx - Create FlowDocumentSink — custom Serilog sink for WPF Paragraph - Remove ILogger from ProtectTabVM — now uses MelLoggerAdapter - ProtectTabVM keeps only IProgressReporter (progress bar + finish) - Delete ~40 lines of manual ILogger boilerplate
Full local CI script that replicates lint.yml, ci.yml, and test.yml: - lint: whitespace, style, and analyzer checks via dotnet format - build: dotnet build for SDK projects + MSBuild.exe for C++/CLI - test: discovers all *.Test.csproj, runs with coverage, summary - package: creates CLI, GUI, and combined zip archives Usage: ./scripts/local-ci.sh [lint|build|test|package|all]
…ging.ILogger (#64) Complete migration from the custom 13-method ILogger interface to the standard M.E.L ILogger abstraction across all projects. - Change ConfuserContext.Logger and ConfuserParameters.Logger to M.E.L ILogger - Convert all ~80 call sites: Debug→LogDebug, Info→LogInformation, Warn→LogWarning, Error→LogError, *Exception→swap parameter order - Rewrite MSBuildLogger as MSBuildMelLogger implementing M.E.L ILogger - Rewrite XUnitLogger implementing M.E.L ILogger + IProgressReporter - Remove MelLoggerAdapter (no longer needed — M.E.L is the native type) - Delete Confuser.Core.ILogger, NullLogger (replaced by M.E.L NullLogger) - Add test-results/ and coverage/ to .gitignore
Lint Results
|
Test Results
Cross-Framework Details
SummarySummary
CoverageConfuser.CLI - 60.6%
Confuser.Core - 25.9%
Confuser.DynCipher - 0.2%
Confuser.Protections - 4.9%
Confuser.Renamer - 42%
Confuser.UnitTest - 0%
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the hand-rolled
Confuser.Core.ILoggerinterface (13 methods, 5 custom implementations) with the industry-standardMicrosoft.Extensions.Loggingabstraction backed by Serilog as the logging provider.Fixes #64
Changes
IProgressReporter— separates progress/finish from logging into its own interfaceMicrosoft.Extensions.Logging.Abstractions(netstandard2.0 compatible)ConsoleLogger, adds--verbose/--quietflagsFlowDocumentSinkreplaces 80+ lines of manual logger boilerplateLogDebug,LogInformation,LogWarning,LogError)Confuser.Core.ILogger,NullLogger,MelLoggerAdapter,PackerLogger,ConsoleLoggerMicrosoft.Extensions.Logging.ILoggerdirectlylocal-ci.sh— full local CI script mirroring GitHub Actions pipelineHasError = falseon failure (inverted logic)New CLI flags
Net result
Test plan
dotnet build Confuser2.sln -c Release— all C# projects compiledotnet test— 29/29 tests pass (CLI=2, CrossFramework=24, GUI=3)./scripts/local-ci.sh test— full pipeline green-vand-qflagsRelated