Struct TraceLogStringHandler
Interpolated string handler for Trace log messages. Defers string construction until the log level is confirmed enabled.
public ref struct TraceLogStringHandler
- Inherited Members
Constructors
TraceLogStringHandler(int, int, ILogger, out bool)
Initializes a new instance of the TraceLogStringHandler struct.
public TraceLogStringHandler(int literalLength, int formattedCount, ILogger logger, out bool isEnabled)
Parameters
literalLengthintThe number of literal characters in the interpolated string.
formattedCountintThe number of interpolation holes in the interpolated string.
loggerILoggerThe logger to check for enabled status.
isEnabledboolOn return, indicates whether logging is enabled for this level.
Methods
AppendFormatted<T>(T)
Appends a formatted value to the handler.
public void AppendFormatted<T>(T value)
Parameters
valueTThe value to format and append.
Type Parameters
TThe type of the value to format.
AppendFormatted<T>(T, int)
Appends a formatted value with alignment to the handler.
public void AppendFormatted<T>(T value, int alignment)
Parameters
valueTThe value to format and append.
alignmentintThe alignment for the formatted value.
Type Parameters
TThe type of the value to format.
AppendFormatted<T>(T, int, string?)
Appends a formatted value with alignment and a format string to the handler.
public void AppendFormatted<T>(T value, int alignment, string? format)
Parameters
valueTThe value to format and append.
alignmentintThe alignment for the formatted value.
formatstringThe format string.
Type Parameters
TThe type of the value to format.
AppendFormatted<T>(T, string?)
Appends a formatted value with a format string to the handler.
public void AppendFormatted<T>(T value, string? format)
Parameters
valueTThe value to format and append.
formatstringThe format string.
Type Parameters
TThe type of the value to format.
AppendLiteral(string)
Appends a literal string to the handler.
public void AppendLiteral(string s)
Parameters
sstringThe literal string to append.