Struct DiagnosticMessageHandler<TLevel>
- Namespace
- SwiftCollections.Diagnostics
- Assembly
- SwiftCollections.dll
Builds interpolated diagnostic messages only when the requested diagnostic level is enabled.
public ref struct DiagnosticMessageHandler<TLevel> where TLevel : struct, IDiagnosticLevelProvider
Type Parameters
TLevelThe fixed diagnostic level provider used by fixed-level helpers.
- Inherited Members
Constructors
DiagnosticMessageHandler(int, int, DiagnosticChannel, DiagnosticLevel, out bool)
Initializes a new handler for a dynamic-level diagnostic message.
public DiagnosticMessageHandler(int literalLength, int formattedCount, DiagnosticChannel channel, DiagnosticLevel level, out bool isEnabled)
Parameters
literalLengthintThe combined length of literal portions in the interpolated string.
formattedCountintThe number of formatted expressions in the interpolated string.
channelDiagnosticChannelThe diagnostic channel that receives the message.
levelDiagnosticLevelThe diagnostic level being evaluated.
isEnabledboolSet to true when formatted expressions should be evaluated.
DiagnosticMessageHandler(int, int, DiagnosticChannel, out bool)
Initializes a new handler for a fixed-level diagnostic message.
public DiagnosticMessageHandler(int literalLength, int formattedCount, DiagnosticChannel channel, out bool isEnabled)
Parameters
literalLengthintThe combined length of literal portions in the interpolated string.
formattedCountintThe number of formatted expressions in the interpolated string.
channelDiagnosticChannelThe diagnostic channel that receives the message.
isEnabledboolSet to true when formatted expressions should be evaluated.
Properties
IsEnabled
Gets whether the handler is actively building a diagnostic message.
public bool IsEnabled { get; }
Property Value
Methods
AppendFormatted<T>(T)
Appends a formatted value.
public void AppendFormatted<T>(T value)
Parameters
valueTThe value to append.
Type Parameters
TThe type of value to append.
AppendFormatted<T>(T, int)
Appends a formatted value with the specified alignment.
public void AppendFormatted<T>(T value, int alignment)
Parameters
valueTThe value to append.
alignmentintThe minimum width for the formatted value.
Type Parameters
TThe type of value to append.
AppendFormatted<T>(T, int, string)
Appends a formatted value with the specified alignment and format string.
public void AppendFormatted<T>(T value, int alignment, string format)
Parameters
valueTThe value to append.
alignmentintThe minimum width for the formatted value.
formatstringThe format string to apply.
Type Parameters
TThe type of value to append.
AppendFormatted<T>(T, string)
Appends a formatted value using the specified format string.
public void AppendFormatted<T>(T value, string format)
Parameters
valueTThe value to append.
formatstringThe format string to apply.
Type Parameters
TThe type of value to append.
AppendLiteral(string)
Appends a literal string segment.
public void AppendLiteral(string value)
Parameters
valuestringThe literal string segment.