ConsoleFormatter.Write<TState> 方法

定义

将日志消息写入指定的 TextWriter。

public:
generic <typename TState>
 abstract void Write(Microsoft::Extensions::Logging::Abstractions::LogEntry<TState> ^ logEntry, Microsoft::Extensions::Logging::IExternalScopeProvider ^ scopeProvider, System::IO::TextWriter ^ textWriter);
public abstract void Write<TState> (in Microsoft.Extensions.Logging.Abstractions.LogEntry<TState> logEntry, Microsoft.Extensions.Logging.IExternalScopeProvider? scopeProvider, System.IO.TextWriter textWriter);
abstract member Write : LogEntry * Microsoft.Extensions.Logging.IExternalScopeProvider * System.IO.TextWriter -> unit
Public MustOverride Sub Write(Of TState) (logEntry As LogEntry(Of TState), scopeProvider As IExternalScopeProvider, textWriter As TextWriter)

类型参数

TState

要写入的对象的类型。

参数

logEntry
LogEntry<TState>

日志条目。

scopeProvider
IExternalScopeProvider

范围数据的提供程序。

textWriter
TextWriter

字符串编写器为颜色嵌入 ansi 代码。

注解

如果格式化程序想要将颜色写入控制台,则可以通过将 ANSI 颜色代码嵌入字符串来执行此操作。

适用于