共用方式為


ILogger.Log<TState> 方法

定義

寫入記錄項目。

public:
generic <typename TState>
 void Log(Microsoft::Extensions::Logging::LogLevel logLevel, Microsoft::Extensions::Logging::EventId eventId, TState state, Exception ^ exception, Func<TState, Exception ^, System::String ^> ^ formatter);
public void Log<TState> (Microsoft.Extensions.Logging.LogLevel logLevel, Microsoft.Extensions.Logging.EventId eventId, TState state, Exception exception, Func<TState,Exception,string> formatter);
public void Log<TState> (Microsoft.Extensions.Logging.LogLevel logLevel, Microsoft.Extensions.Logging.EventId eventId, TState state, Exception? exception, Func<TState,Exception?,string> formatter);
abstract member Log : Microsoft.Extensions.Logging.LogLevel * Microsoft.Extensions.Logging.EventId * 'State * Exception * Func<'State, Exception, string> -> unit
Public Sub Log(Of TState) (logLevel As LogLevel, eventId As EventId, state As TState, exception As Exception, formatter As Func(Of TState, Exception, String))

類型參數

TState

要寫入之物件的類型。

參數

logLevel
LogLevel

項目會在此層級寫入。

eventId
EventId

事件的識別碼。

state
TState

要寫入的項目。 也可以是物件。

exception
Exception

與此項目相關的例外狀況。

formatter
Func<TState,Exception,String>

建立 stateexceptionString 訊息的函式。

適用於