Summary
There are three separate test logger implementations in src/Akka.Hosting.Tests/Logging/ that share significant overlap:
TestLogger (TestLogger.cs) — captures messages by log level
SemanticTestLogger (SemanticLoggingSpecs.cs) — captures message + structured state dictionary
BugReproTestSink (Issue701SemanticLoggingRegressionSpecs.cs) — captures message + structured state dictionary
Implementations 2 and 3 are ~95% identical:
- Both implement
ILogger
- Both capture the formatted message and enumerate
IEnumerable<KeyValuePair<string, object>> state into a dictionary
- Both write to
ITestOutputHelper
- Only minor naming differences (
Entries vs LogEntries, BugReproLogEntry vs LogEntry)
Proposed Change
Extract a shared StructuredTestLogger and CapturedLogEntry into a common file (e.g., SharedLoggingTestUtilities.cs) and have both test classes use it. This reduces maintenance burden when the logging infrastructure changes.
Summary
There are three separate test logger implementations in
src/Akka.Hosting.Tests/Logging/that share significant overlap:TestLogger(TestLogger.cs) — captures messages by log levelSemanticTestLogger(SemanticLoggingSpecs.cs) — captures message + structured state dictionaryBugReproTestSink(Issue701SemanticLoggingRegressionSpecs.cs) — captures message + structured state dictionaryImplementations 2 and 3 are ~95% identical:
ILoggerIEnumerable<KeyValuePair<string, object>>state into a dictionaryITestOutputHelperEntriesvsLogEntries,BugReproLogEntryvsLogEntry)Proposed Change
Extract a shared
StructuredTestLoggerandCapturedLogEntryinto a common file (e.g.,SharedLoggingTestUtilities.cs) and have both test classes use it. This reduces maintenance burden when the logging infrastructure changes.