< Summary

Information
Class: SwiftCollections.Diagnostics.DiagnosticEvent
Assembly: SwiftCollections
File(s): /home/runner/work/SwiftCollections/SwiftCollections/src/SwiftCollections/Diagnostics/DiagnosticEvent.cs
Line coverage
100%
Covered lines: 5
Uncovered lines: 0
Coverable lines: 5
Total lines: 53
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%66100%

File(s)

/home/runner/work/SwiftCollections/SwiftCollections/src/SwiftCollections/Diagnostics/DiagnosticEvent.cs

#LineLine coverage
 1//=======================================================================
 2// DiagnosticEvent.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024–present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8namespace SwiftCollections.Diagnostics;
 9
 10/// <summary>
 11/// Represents a single diagnostic event emitted by a <see cref="DiagnosticChannel"/>.
 12/// </summary>
 13public readonly struct DiagnosticEvent
 14{
 15    /// <summary>
 16    /// Initializes a new instance of the <see cref="DiagnosticEvent"/> struct.
 17    /// </summary>
 18    /// <param name="channel">The channel that emitted the event.</param>
 19    /// <param name="level">The severity level of the event.</param>
 20    /// <param name="message">The event message.</param>
 21    /// <param name="source">An optional source identifier.</param>
 22    public DiagnosticEvent(
 23        string channel,
 24        DiagnosticLevel level,
 25        string message,
 26        string source = "")
 27    {
 1828        Channel = channel ?? string.Empty;
 1829        Level = level;
 1830        Message = message ?? string.Empty;
 1831        Source = source ?? string.Empty;
 1832    }
 33
 34    /// <summary>
 35    /// Gets the channel that emitted the event.
 36    /// </summary>
 37    public string Channel { get; }
 38
 39    /// <summary>
 40    /// Gets the severity level of the event.
 41    /// </summary>
 42    public DiagnosticLevel Level { get; }
 43
 44    /// <summary>
 45    /// Gets the diagnostic message.
 46    /// </summary>
 47    public string Message { get; }
 48
 49    /// <summary>
 50    /// Gets the optional source identifier.
 51    /// </summary>
 52    public string Source { get; }
 53}