Class DiagnosticChannel
- Namespace
- SwiftCollections.Diagnostics
- Assembly
- SwiftCollections.dll
Represents a named diagnostic channel with a configurable sink and minimum level.
public sealed class DiagnosticChannel
- Inheritance
-
DiagnosticChannel
- Inherited Members
- Extension Methods
Constructors
DiagnosticChannel(string)
Initializes a new instance of the DiagnosticChannel class.
public DiagnosticChannel(string name)
Parameters
namestringThe channel name. Blank names fall back to
Default.
Properties
MinimumLevel
Gets or sets the minimum level required for diagnostics to be emitted.
public DiagnosticLevel MinimumLevel { get; set; }
Property Value
Name
Gets the channel name.
public string Name { get; }
Property Value
Sink
Gets or sets the sink that receives emitted diagnostics.
Assigning null restores the default no-op sink.
public DiagnosticSink Sink { get; set; }
Property Value
Methods
IsEnabled(DiagnosticLevel)
Determines whether the specified level is enabled for this channel.
public bool IsEnabled(DiagnosticLevel level)
Parameters
levelDiagnosticLevelThe level to evaluate.
Returns
- bool
truewhen the level is enabled; otherwise,false.
Write(DiagnosticLevel, DiagnosticInterpolatedStringHandler, string)
Emits a diagnostic event from an interpolated message when the specified level is enabled. Disabled levels do not evaluate formatted interpolation expressions.
public void Write(DiagnosticLevel level, DiagnosticInterpolatedStringHandler message, string source = "")
Parameters
levelDiagnosticLevelThe severity level of the diagnostic event.
messageDiagnosticInterpolatedStringHandlerThe interpolated diagnostic message.
sourcestringAn optional source identifier.
Write(DiagnosticLevel, string, string)
Emits a diagnostic event when the specified level is enabled.
public void Write(DiagnosticLevel level, string message, string source = "")
Parameters
levelDiagnosticLevelThe severity level of the diagnostic event.
messagestringThe diagnostic message.
sourcestringAn optional source identifier.