| | | 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 | | |
| | | 8 | | namespace SwiftCollections.Diagnostics; |
| | | 9 | | |
| | | 10 | | /// <summary> |
| | | 11 | | /// Represents a single diagnostic event emitted by a <see cref="DiagnosticChannel"/>. |
| | | 12 | | /// </summary> |
| | | 13 | | public 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 | | { |
| | 18 | 28 | | Channel = channel ?? string.Empty; |
| | 18 | 29 | | Level = level; |
| | 18 | 30 | | Message = message ?? string.Empty; |
| | 18 | 31 | | Source = source ?? string.Empty; |
| | 18 | 32 | | } |
| | | 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 | | } |