Table of Contents

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

Level DiagnosticLevel

How much the event matters.

Source string

The part of Egami that found it, such as "Png", "Tiff", "Exif" or "Limits": the id up to its first dot.

Id string

A stable id, such as "Png.ChecksumMismatch", for filtering and counting without parsing Message.

Message string

What happened and what Egami did, as a sentence.

Offset long?

The byte offset in the input the event is about, or null when not known.

Frame int?

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

string

Level

How much the event matters.

public DiagnosticLevel Level { get; init; }

Property Value

DiagnosticLevel

Message

What happened and what Egami did, as a sentence.

public string Message { get; init; }

Property Value

string

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

string

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.