I​Logger I​Logger Interface

Definition

Represents a type used to perform logging.
public interface ILoggerPublic Interface ILogger

Remarks

Aggregates most logging patterns to a single method.

Methods

BeginScope<TState>(TState) BeginScope(Of TState)(TState)

Begins a logical operation scope.
IDisposable BeginScope<TState>(TState state)Function BeginScope(Of TState)(state As TState) As IDisposable
Type Parameters
TState
Parameters
state
TState TState
The identifier for the scope.
Returns
IDisposable IDisposable
An IDisposable that ends the logical operation scope on dispose.

IsEnabled(LogLevel) IsEnabled(LogLevel)

Checks if the given logLevel is enabled.
bool IsEnabled(LogLevel logLevel)Function IsEnabled(logLevel As LogLevel) As Boolean
Parameters
logLevel
LogLevel LogLevel
level to be checked.
Returns
System.Boolean System.Boolean
true if enabled.

Log<TState>(LogLevel, EventId, TState, Exception, Func<TState, Exception, String>) Log(Of TState)(LogLevel, EventId, TState, Exception, Func(Of TState, Exception, String))

Writes a log entry.
void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)Sub Log(Of TState)(logLevel As LogLevel, eventId As EventId, state As TState, exception As Exception, formatter As Func(Of TState, Exception, String))
Type Parameters
TState
Parameters
logLevel
LogLevel LogLevel
Entry will be written on this level.
eventId
EventId EventId
Id of the event.
state
TState TState
The entry to be written. Can be also an object.
exception
Exception Exception
The exception related to this entry.
formatter
Func<TState, Exception, System.String> Func(Of TState, Exception, System.String)
Function to create a string message of the state and exception.