Struct InstrumentsInterpolatedStringHandler
Low-allocation interpolated string handler used by Log(Scope, LevelOfDetail, ref InstrumentsInterpolatedStringHandler) and Trace(Scope, LevelOfDetail, ref InstrumentsInterpolatedStringHandler). The compiler selects this handler automatically when the sink is disabled, skipping all formatting entirely.
public ref struct InstrumentsInterpolatedStringHandler
- Inherited Members
Constructors
InstrumentsInterpolatedStringHandler(int, int, InstrumentsAccessor, Scope, LevelOfDetail, out bool)
Called by the compiler to initialize the handler and decide whether formatting is needed.
public InstrumentsInterpolatedStringHandler(int literalLength, int formattedCount, InstrumentsAccessor accessor, Scope scope, LevelOfDetail lod, out bool shouldAppend)
Parameters
literalLengthintTotal character count of all literal string segments.
formattedCountintNumber of interpolated holes in the string.
accessorInstrumentsAccessorThe accessor used to check whether the sink is enabled.
scopeScopeThe instrumentation scope.
lodLevelOfDetailThe level of detail.
shouldAppendboolSet to
trueif formatting should proceed;falseto skip.
Methods
AppendFormatted(object?)
Appends any object by calling ToString().
public void AppendFormatted(object? value)
Parameters
valueobject
AppendFormatted(ReadOnlySpan<char>)
Appends a ReadOnlySpan<T> of characters directly.
public void AppendFormatted(ReadOnlySpan<char> value)
Parameters
valueReadOnlySpan<char>
AppendFormatted(string?)
Appends a string value.
public void AppendFormatted(string? value)
Parameters
valuestring
AppendFormatted<T>(T)
Appends a span-formattable value using its default format.
public void AppendFormatted<T>(T value) where T : ISpanFormattable
Parameters
valueT
Type Parameters
T
AppendFormatted<T>(T, ReadOnlySpan<char>)
Appends a span-formattable value using the specified format string.
public void AppendFormatted<T>(T value, ReadOnlySpan<char> format) where T : ISpanFormattable
Parameters
valueTformatReadOnlySpan<char>
Type Parameters
T
AppendLiteral(string)
Appends a literal string segment to the buffer.
public void AppendLiteral(string s)
Parameters
sstring
AsSpan()
Returns the currently accumulated characters as a read-only span.
public readonly ReadOnlySpan<char> AsSpan()
Returns
Dispose()
Returns any rented array buffer back to the pool.
public void Dispose()