ILogger ILogger Interface

Represents a type used to perform logging.

Syntax

Declaration

public interface ILoggerPublic Interface ILogger

Remarks

Aggregates most logging patterns to a single method.

Methods summary

Begins a logical operation scope.
Checks if the given logLevel is enabled.
Writes a log entry.

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

    Parameters

    • state
      TState
      TState
      The identifier for the scope.

    Returns

    • System.IDisposable
      System.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

    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))

    Parameters

    • logLevel
      Entry will be written on this level.
    • eventId
      Id of the event.
    • state
      TState
      TState
      The entry to be written. Can be also an object.
    • exception
      System.Exception
      System.Exception
      The exception related to this entry.
    • formatter
      System.Func<T1, T2, TResult><TState, System.Exception, System.String>
      System.Func<T1, T2, TResult>(Of TState, System.Exception, System.String)
      Function to create a string message of the state and exception.

Details

Assembly

Microsoft.Extensions.Logging.Abstractions.dll