Struct LogEntry

One log record, immutable from the moment the call site builds it.

Implements
Namespace: MOSAIC.Diagnostics
Assembly: MOSAIC.dll
Syntax
public readonly record struct LogEntry : IEquatable<LogEntry>
Remarks

A readonly record struct rather than a class: an entry travels from a producer thread through a bounded channel to the writer thread and then into the panel's ring, and a struct keeps that journey free of per-entry heap objects beyond the message string itself.

Constructors

LogEntry(long, DateTime, LogLevel, string, string?, string)

One log record, immutable from the moment the call site builds it.

Declaration
public LogEntry(long Sequence, DateTime TimestampLocal, LogLevel Level, string Category, string? Instance, string Message)
Parameters
Type Name Description
long Sequence

Monotonic id handed out by Log. The panel's read cursor.

DateTime TimestampLocal

Local wall-clock time, because the reader is a student at the rig.

LogLevel Level

Severity. Never None.

string Category

Component name, e.g. Delsys or Delsys:Scan.

string Instance

Block instance name when there can be more than one, otherwise null.

string Message

The already-formatted message body.

Remarks

A readonly record struct rather than a class: an entry travels from a producer thread through a bounded channel to the writer thread and then into the panel's ring, and a struct keeps that journey free of per-entry heap objects beyond the message string itself.

Properties

Category

Component name, e.g. Delsys or Delsys:Scan.

Declaration
public string Category { get; init; }
Property Value
Type Description
string

Instance

Block instance name when there can be more than one, otherwise null.

Declaration
public string? Instance { get; init; }
Property Value
Type Description
string

Level

Severity. Never None.

Declaration
public LogLevel Level { get; init; }
Property Value
Type Description
LogLevel

Message

The already-formatted message body.

Declaration
public string Message { get; init; }
Property Value
Type Description
string

Prefix

The bracketed component tag, e.g. [Delsys:Scan] or [SupervisedUMAP 'umap1'].

Declaration
public string Prefix { get; }
Property Value
Type Description
string
Remarks

Constructed centrally so every log sink receives the same component format.

Sequence

Monotonic id handed out by Log. The panel's read cursor.

Declaration
public long Sequence { get; init; }
Property Value
Type Description
long

TimeText

Time column for the panel, HH:mm:ss.fff.

Declaration
public string TimeText { get; }
Property Value
Type Description
string
Remarks

Computed on read rather than stored: the panel shows at most a screenful, while every entry would otherwise pay for a string it will probably never display.

TimestampLocal

Local wall-clock time, because the reader is a student at the rig.

Declaration
public DateTime TimestampLocal { get; init; }
Property Value
Type Description
DateTime

Methods

LevelText(LogLevel)

Declaration
private static string LevelText(LogLevel level)
Parameters
Type Name Description
LogLevel level
Returns
Type Description
string

ToLogLine()

The exact line the file sink appends, without a trailing newline.

Declaration
public string ToLogLine()
Returns
Type Description
string
Remarks

Embedded newlines (a stack trace) are re-indented rather than left flush left, so a line-oriented reader such as Select-String still sees one record per timestamp while the continuation stays visually attached to it.

Implements

IEquatable<T>

Search documentation

Start typing to search the documentation.