Κοινή χρήση μέσω


FakeLogger<T> Class

Definition

A logger which captures everything logged to it and enables inspection.

generic <typename T>
public ref class FakeLogger sealed : Microsoft::Extensions::Logging::Testing::FakeLogger, Microsoft::Extensions::Logging::ILogger<T>
public sealed class FakeLogger<T> : Microsoft.Extensions.Logging.Testing.FakeLogger, Microsoft.Extensions.Logging.ILogger<T>
type FakeLogger<'T> = class
    inherit FakeLogger
    interface ILogger<'T>
    interface ILogger
Public NotInheritable Class FakeLogger(Of T)
Inherits FakeLogger
Implements ILogger(Of T)

Type Parameters

T

The type whose name to use as a logger category.

Inheritance
FakeLogger<T>
Implements

Remarks

This type is intended for use in unit tests. It captures all the log state to memory and lets you inspect it to validate that your code is logging what it should.

Constructors

FakeLogger<T>(Action<String>)

Initializes a new instance of the FakeLogger<T> class that copies all log records to the given output sink.

FakeLogger<T>(FakeLogCollector)

Initializes a new instance of the FakeLogger<T> class.

Properties

Category

Gets this logger's category, as specified when the logger was created.

(Inherited from FakeLogger)
Collector

Gets the logger collector associated with this logger, as specified when the logger was created.

(Inherited from FakeLogger)
LatestRecord

Gets the latest record logged to this logger.

(Inherited from FakeLogger)

Methods

BeginScope<TState>(TState)

Begins a logical operation scope.

(Inherited from FakeLogger)
ControlLevel(LogLevel, Boolean)

Controls the enabled state of a log level.

(Inherited from FakeLogger)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
IsEnabled(LogLevel)

Checks if the given log level is enabled.

(Inherited from FakeLogger)
Log<TState>(LogLevel, EventId, TState, Exception, Func<TState,Exception,String>)

Creates a new log record.

(Inherited from FakeLogger)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Extension Methods

BeginScope(ILogger, String, Object[])

Formats the message and creates a scope.

Log(ILogger, LogLevel, EventId, Exception, String, Object[])

Formats and writes a log message at the specified log level.

Log(ILogger, LogLevel, EventId, String, Object[])

Formats and writes a log message at the specified log level.

Log(ILogger, LogLevel, Exception, String, Object[])

Formats and writes a log message at the specified log level.

Log(ILogger, LogLevel, String, Object[])

Formats and writes a log message at the specified log level.

LogCritical(ILogger, EventId, Exception, String, Object[])

Formats and writes a critical log message.

LogCritical(ILogger, EventId, String, Object[])

Formats and writes a critical log message.

LogCritical(ILogger, Exception, String, Object[])

Formats and writes a critical log message.

LogCritical(ILogger, String, Object[])

Formats and writes a critical log message.

LogDebug(ILogger, EventId, Exception, String, Object[])

Formats and writes a debug log message.

LogDebug(ILogger, EventId, String, Object[])

Formats and writes a debug log message.

LogDebug(ILogger, Exception, String, Object[])

Formats and writes a debug log message.

LogDebug(ILogger, String, Object[])

Formats and writes a debug log message.

LogError(ILogger, EventId, Exception, String, Object[])

Formats and writes an error log message.

LogError(ILogger, EventId, String, Object[])

Formats and writes an error log message.

LogError(ILogger, Exception, String, Object[])

Formats and writes an error log message.

LogError(ILogger, String, Object[])

Formats and writes an error log message.

LogInformation(ILogger, EventId, Exception, String, Object[])

Formats and writes an informational log message.

LogInformation(ILogger, EventId, String, Object[])

Formats and writes an informational log message.

LogInformation(ILogger, Exception, String, Object[])

Formats and writes an informational log message.

LogInformation(ILogger, String, Object[])

Formats and writes an informational log message.

LogTrace(ILogger, EventId, Exception, String, Object[])

Formats and writes a trace log message.

LogTrace(ILogger, EventId, String, Object[])

Formats and writes a trace log message.

LogTrace(ILogger, Exception, String, Object[])

Formats and writes a trace log message.

LogTrace(ILogger, String, Object[])

Formats and writes a trace log message.

LogWarning(ILogger, EventId, Exception, String, Object[])

Formats and writes a warning log message.

LogWarning(ILogger, EventId, String, Object[])

Formats and writes a warning log message.

LogWarning(ILogger, Exception, String, Object[])

Formats and writes a warning log message.

LogWarning(ILogger, String, Object[])

Formats and writes a warning log message.

Applies to