Table of Contents

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

name string

The 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

DiagnosticLevel

Name

Gets the channel name.

public string Name { get; }

Property Value

string

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

DiagnosticSink

Methods

IsEnabled(DiagnosticLevel)

Determines whether the specified level is enabled for this channel.

public bool IsEnabled(DiagnosticLevel level)

Parameters

level DiagnosticLevel

The level to evaluate.

Returns

bool

true when 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

level DiagnosticLevel

The severity level of the diagnostic event.

message DiagnosticInterpolatedStringHandler

The interpolated diagnostic message.

source string

An 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

level DiagnosticLevel

The severity level of the diagnostic event.

message string

The diagnostic message.

source string

An optional source identifier.