Table of Contents

Class LoggerExtensions

Namespace
Codebelt.Extensions.Xunit.Hosting
Assembly
Codebelt.Extensions.Xunit.Hosting.dll

Extension methods for the ILogger<TCategoryName> interface.

public static class LoggerExtensions
Inheritance
LoggerExtensions

Methods

GetTestStore(ILogger, String)

Returns the associated ITestStore<T> that is provided when settings up services from AddXunitTestLogging(IServiceCollection, LogLevel) or related.

public static ITestStore<XunitTestLoggerEntry> GetTestStore(this ILogger logger, string categoryName = null)

Parameters

logger ILogger

The ILogger<TCategoryName> from which to retrieve the ITestStore<T>.

categoryName String

The category name for messages produced by the logger -or- null for messages produced by all loggers.

Returns

ITestStore<XunitTestLoggerEntry>

Returns an implementation of ITestStore<T> with all logged entries expressed as XunitTestLoggerEntry.

Exceptions

ArgumentNullException

logger cannot be null.

ArgumentException

logger does not contain a test store.

KeyNotFoundException

logger does not contain a test store for the specified categoryName.

GetTestStore<T>(ILogger<T>)

Returns the associated ITestStore<T> that is provided when settings up services from AddXunitTestLogging(IServiceCollection, LogLevel) or related.

public static ITestStore<XunitTestLoggerEntry> GetTestStore<T>(this ILogger<T> logger)

Parameters

logger ILogger<T>

The ILogger<TCategoryName> from which to retrieve the ITestStore<T>.

Returns

ITestStore<XunitTestLoggerEntry>

Returns an implementation of ITestStore<T> with all logged entries expressed as XunitTestLoggerEntry.

Type Parameters

T

Exceptions

ArgumentNullException

logger cannot be null.

ArgumentException

logger does not contain a test store.