Namespace LogAssertions
Classes
- FakeLogCollectorInspectionExtensions
Non-asserting inspection helpers on Microsoft.Extensions.Logging.Testing.FakeLogCollector. Use these when a test needs to read the captured records as data: for downstream calculations, debugging output, or cross-checking: rather than to assert. None of these methods throw on mismatch.
- LogAssertionRendering
Shared helpers for rendering captured log records into human-readable text. Used both by the assertion classes (failure-message snapshot rendering) and by the
FakeLogCollectorInspectionExtensions.DumpToextension.
- LogCollectorBuilder
Convenience factory that constructs a Microsoft.Extensions.Logging.Testing.FakeLogCollector together with an ILoggerFactory that writes into it. Replaces the 3-4 lines of boilerplate every test would otherwise need.
- LogFilter
Static factory for composable ILogRecordFilter instances. The fluent chain on
HasLogged()/HasNotLogged()/HasLoggedSequence()creates filters internally; this class exposes the same primitives for users who want to build reusable filter objects, share them across tests, or compose them via All(params ILogRecordFilter[]) / Any(params ILogRecordFilter[]) / Not(ILogRecordFilter).
Interfaces
- ILogRecordFilter
A composable filter over Microsoft.Extensions.Logging.Testing.FakeLogRecord. Built-in filter methods on the assertion fluent chain (
AtLevel,Containing, etc.) each create one of these internally;WithFilter(ILogRecordFilter)on the chain accepts arbitrary user implementations, and the LogFilter static factory composes them viaAll,Any, andNot.
Enums
- DumpVerbosity
Verbosity level for
DumpTo(TextWriter, DumpVerbosity)and the TUnit-sideDumpToTestOutput(DumpVerbosity)overload. Controls how much detail is rendered per record: just the headline (Compact), the standard one-line-each detail (Default), or the full exception stack trace alongside the rest (Verbose).