| | | 1 | | namespace SwiftCollections.Diagnostics; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Represents a single diagnostic event emitted by a <see cref="DiagnosticChannel"/>. |
| | | 5 | | /// </summary> |
| | | 6 | | public readonly struct DiagnosticEvent |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Initializes a new instance of the <see cref="DiagnosticEvent"/> struct. |
| | | 10 | | /// </summary> |
| | | 11 | | /// <param name="channel">The channel that emitted the event.</param> |
| | | 12 | | /// <param name="level">The severity level of the event.</param> |
| | | 13 | | /// <param name="message">The event message.</param> |
| | | 14 | | /// <param name="source">An optional source identifier.</param> |
| | | 15 | | public DiagnosticEvent( |
| | | 16 | | string channel, |
| | | 17 | | DiagnosticLevel level, |
| | | 18 | | string message, |
| | | 19 | | string source = "") |
| | 3 | 20 | | { |
| | 3 | 21 | | Channel = channel ?? string.Empty; |
| | 3 | 22 | | Level = level; |
| | 3 | 23 | | Message = message ?? string.Empty; |
| | 3 | 24 | | Source = source ?? string.Empty; |
| | 3 | 25 | | } |
| | | 26 | | |
| | | 27 | | /// <summary> |
| | | 28 | | /// Gets the channel that emitted the event. |
| | | 29 | | /// </summary> |
| | 2 | 30 | | public string Channel { get; } |
| | | 31 | | |
| | | 32 | | /// <summary> |
| | | 33 | | /// Gets the severity level of the event. |
| | | 34 | | /// </summary> |
| | 2 | 35 | | public DiagnosticLevel Level { get; } |
| | | 36 | | |
| | | 37 | | /// <summary> |
| | | 38 | | /// Gets the diagnostic message. |
| | | 39 | | /// </summary> |
| | 2 | 40 | | public string Message { get; } |
| | | 41 | | |
| | | 42 | | /// <summary> |
| | | 43 | | /// Gets the optional source identifier. |
| | | 44 | | /// </summary> |
| | 2 | 45 | | public string Source { get; } |
| | | 46 | | } |