< Summary

Information
Class: Chronicler.Diagnostics.DiagnosticEvent
Assembly: Chronicler.Diagnostics
File(s): /home/runner/work/Chronicler/Chronicler/src/Chronicler.Diagnostics/DiagnosticEvent.cs
Line coverage
100%
Covered lines: 5
Uncovered lines: 0
Coverable lines: 5
Total lines: 47
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/Chronicler/Chronicler/src/Chronicler.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 Chronicler.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>Creates an immutable diagnostic event.</summary>
 16    /// <param name="channel">The channel label. Null becomes empty.</param>
 17    /// <param name="level">The severity attached to the event.</param>
 18    /// <param name="message">The rendered event text. Null becomes empty.</param>
 19    /// <param name="source">The optional origin label. Null or omission becomes empty.</param>
 20    public DiagnosticEvent(
 21        string channel,
 22        DiagnosticLevel level,
 23        string message,
 24        string source = "")
 25    {
 2126        Channel = channel ?? string.Empty;
 2127        Level = level;
 2128        Message = message ?? string.Empty;
 2129        Source = source ?? string.Empty;
 2130    }
 31
 32    /// <summary>Gets the channel label.</summary>
 33    /// <value>The emitting channel's name.</value>
 34    public string Channel { get; }
 35
 36    /// <summary>Gets event severity.</summary>
 37    /// <value>The level carried through to sinks and formatters.</value>
 38    public DiagnosticLevel Level { get; }
 39
 40    /// <summary>Gets the event text.</summary>
 41    /// <value>The caller's formatted message, with null normalized to empty.</value>
 42    public string Message { get; }
 43
 44    /// <summary>Gets the origin label.</summary>
 45    /// <value>The supplied origin or an empty string.</value>
 46    public string Source { get; }
 47}