Skip to content

InMemoryLogger Methods

A logger that writes to an in-memory buffer via the InMemoryLogBuffer.

BeginScope(TState)

View source
public IDisposable? BeginScope<TState>(TState state)
Begins a logical operation scope.

Parameters

stateTState
The identifier for the scope.

Returns

An System.IDisposable that ends the logical operation scope on dispose.

IsEnabled(LogLevel)

View source
public bool IsEnabled(LogLevel logLevel)
Checks if the given logLevel is enabled.

Parameters

logLevelLogLevel
Level to be checked.

Returns

true if enabled.

Log(LogLevel, EventId, TState, Exception?, Func<TState, Exception?, string>)

View source
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
Writes a log entry.

Parameters

logLevelLogLevel
Entry will be written on this level.
eventIdEventId
Id of the event.
stateTState
The entry to be written. Can be also an object.
exceptionException?
The exception related to this entry.
formatterFunc<TState, Exception?, string>
Function to create a System.String message of the state and exception.