Struct EgamiDiagnostic
- Namespace
- Egami
- Assembly
- Egami.dll
One event reported to Diagnostics, and the type of each entry in Warnings. Ids are listed in the diagnostics article and never renamed or reused.
public readonly record struct EgamiDiagnostic : IEquatable<EgamiDiagnostic>
- Implements
- Inherited Members
Examples
// With Microsoft.Extensions.Logging: one line at startup sends every call's warnings to the app's log, with the id as
// a property to filter and count on. Egami itself has no logging dependency.
EgamiContext.SetDefault(new EgamiContext
{
Diagnostics = d => logger.Log(d.Level.ToLogLevel(), "{Source} {Id} at {Offset}: {Message}", d.Source, d.Id, d.Offset, d.Message),
});
Constructors
EgamiDiagnostic(DiagnosticLevel, string, string, string, long?, int?)
One event reported to Diagnostics, and the type of each entry in Warnings. Ids are listed in the diagnostics article and never renamed or reused.
public EgamiDiagnostic(DiagnosticLevel Level, string Source, string Id, string Message, long? Offset, int? Frame)
Parameters
LevelDiagnosticLevelHow much the event matters.
SourcestringThe part of Egami that found it, such as "Png", "Tiff", "Exif" or "Limits": the id up to its first dot.
IdstringA stable id, such as "Png.ChecksumMismatch", for filtering and counting without parsing
Message.MessagestringWhat happened and what Egami did, as a sentence.
Offsetlong?The byte offset in the input the event is about, or null when not known.
Frameint?The frame or page index the event is about, or null when not known or not frame-specific.
Examples
// With Microsoft.Extensions.Logging: one line at startup sends every call's warnings to the app's log, with the id as
// a property to filter and count on. Egami itself has no logging dependency.
EgamiContext.SetDefault(new EgamiContext
{
Diagnostics = d => logger.Log(d.Level.ToLogLevel(), "{Source} {Id} at {Offset}: {Message}", d.Source, d.Id, d.Offset, d.Message),
});
Properties
Frame
The frame or page index the event is about, or null when not known or not frame-specific.
public int? Frame { get; init; }
Property Value
- int?
Id
A stable id, such as "Png.ChecksumMismatch", for filtering and counting without parsing Message.
public string Id { get; init; }
Property Value
Level
How much the event matters.
public DiagnosticLevel Level { get; init; }
Property Value
Message
What happened and what Egami did, as a sentence.
public string Message { get; init; }
Property Value
Offset
The byte offset in the input the event is about, or null when not known.
public long? Offset { get; init; }
Property Value
- long?
Source
The part of Egami that found it, such as "Png", "Tiff", "Exif" or "Limits": the id up to its first dot.
public string Source { get; init; }
Property Value
Methods
ToString()
Returns the id and the message, such as "Png.ChecksumMismatch: The IDAT checksum is wrong…".
public override string ToString()
Returns
- string
The text.