Skip to content

DiGi.Log.Classes

github-actions[bot] edited this page Jul 15, 2026 · 2 revisions

DiGi.Log.Classes Namespace

Classes

Log Class

Represents a standard log collection using LogRecord entries.

public class Log : DiGi.Log.Classes.Log<DiGi.Log.Classes.LogRecord>

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectDiGi.Log.Classes.Log<LogRecord> → Log

Constructors

Log() Constructor

Initializes a new instance of the Log class.

public Log();

Log(Log) Constructor

Initializes a new instance of the Log class by cloning an existing log object.

public Log(DiGi.Log.Classes.Log? log);

Parameters

log Log

The source log object to clone.

Log(IEnumerable<LogRecord>) Constructor

Initializes a new instance of the Log class with a specified collection of log records.

public Log(System.Collections.Generic.IEnumerable<DiGi.Log.Classes.LogRecord>? logRecords);

Parameters

logRecords System.Collections.Generic.IEnumerable<LogRecord>

The initial collection of log records to populate the log.

Log(JsonObject) Constructor

Initializes a new instance of the Log class from a JSON object.

public Log(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing log data.

Methods

Log.Add(LogRecord) Method

Adds a new log record to the collection after cloning it.

public DiGi.Log.Classes.LogRecord? Add(DiGi.Log.Classes.LogRecord? logRecord);

Parameters

logRecord LogRecord

The log record to add.

Returns

LogRecord
The added log record, or null if the input was null.

Log.Add(LogRecordType, string, object[]) Method

Creates and adds a new log record based on the specified type and format.

public DiGi.Log.Classes.LogRecord? Add(DiGi.Log.Enums.LogRecordType logRecordType, string format, params object[] values);

Parameters

logRecordType LogRecordType

The type of the log record.

format System.String

The format string for the log message.

values System.Object[]

The values to be formatted into the message.

Returns

LogRecord
The created and added log record.

Log.AddRange(IEnumerable<LogRecord>) Method

Adds a range of log records to the collection.

public System.Collections.Generic.List<DiGi.Log.Classes.LogRecord>? AddRange(System.Collections.Generic.IEnumerable<DiGi.Log.Classes.LogRecord>? logRecords);

Parameters

logRecords System.Collections.Generic.IEnumerable<LogRecord>

The collection of log records to add.

Returns

System.Collections.Generic.List<LogRecord>
A list of successfully added log records, or null if the input was null.

Log.Clone() Method

Creates a shallow copy of the current log instance.

public override DiGi.Core.Interfaces.ISerializableObject Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A cloned DiGi.Core.Interfaces.ISerializableObject representing the log.

Log<T> Class

Represents a base collection of log records.

public abstract class Log<T> : DiGi.Core.Classes.SerializableObject, System.Collections.Generic.IEnumerable<T>, System.Collections.IEnumerable
    where T : DiGi.Log.Interfaces.ILogRecord

Type parameters

T

The type of log record, which must implement ILogRecord.

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObject → Log<T>

Derived
Log

Implements System.Collections.Generic.IEnumerable<T>, System.Collections.IEnumerable

Constructors

Log() Constructor

Initializes a new instance of the Log<T> class.

public Log();

Log(Log<T>) Constructor

Initializes a new instance of the Log<T> class by cloning an existing log object.

public Log(DiGi.Log.Classes.Log<T>? log);

Parameters

log DiGi.Log.Classes.Log<T>

The source log object to clone.

Log(IEnumerable<T>) Constructor

Initializes a new instance of the Log<T> class with a specified collection of log records.

public Log(System.Collections.Generic.IEnumerable<T>? logRecords);

Parameters

logRecords System.Collections.Generic.IEnumerable<T>

The initial collection of log records to populate the log.

Log(JsonObject) Constructor

Initializes a new instance of the Log<T> class from a JSON object.

public Log(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing log data.

Fields

Log<T>.logRecords Field

The internal list of log records.

protected List<T> logRecords;

Field Value

System.Collections.Generic.List<T>

Methods

Log<T>.GetEnumerator() Method

Returns an enumerator that iterates through the collection of log records.

public System.Collections.Generic.IEnumerator<T> GetEnumerator();

Implements GetEnumerator(), GetEnumerator()

Returns

System.Collections.Generic.IEnumerator<T>
A typed enumerator for T.

Log<T>.ToString() Method

Returns a string representation of all log records, separated by environment new lines.

public override string? ToString();

Returns

System.String
A concatenated string of all log records, or null if the record list is null.

Log<T>.Write(string) Method

Writes the contents of the log to a specified file path.

public bool Write(string? path);

Parameters

path System.String

The destination file path.

Returns

System.Boolean
True if the write operation was successful; otherwise, false.

Explicit Interface Implementations

System.Collections.IEnumerable.GetEnumerator() Method

Returns an enumerator that iterates through the collection of log records.

System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator();

Implements GetEnumerator()

LogRecord Class

Represents a log record entry containing timestamp, identification, type, and message text.

public class LogRecord : DiGi.Core.Classes.SerializableObject, DiGi.Log.Interfaces.ILogRecord, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObject → LogRecord

Implements ILogRecord, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Constructors

LogRecord(LogRecord) Constructor

Initializes a new instance of the LogRecord class by copying an existing record.

public LogRecord(DiGi.Log.Classes.LogRecord? logRecord);

Parameters

logRecord LogRecord

The source log record to copy from.

LogRecord(LogRecordType, string) Constructor

Initializes a new instance of the LogRecord class using current UTC time and no identifier.

public LogRecord(DiGi.Log.Enums.LogRecordType logRecordType, string? text);

Parameters

logRecordType LogRecordType

The type or severity of the log record.

text System.String

The descriptive text of the log message.

LogRecord(string, LogRecordType, string) Constructor

Initializes a new instance of the LogRecord class using the current UTC time.

public LogRecord(string? id, DiGi.Log.Enums.LogRecordType logRecordType, string? text);

Parameters

id System.String

The unique identifier for the record.

logRecordType LogRecordType

The type or severity of the log record.

text System.String

The descriptive text of the log message.

LogRecord(DateTime, LogRecordType, string) Constructor

Initializes a new instance of the LogRecord class without an identifier.

public LogRecord(System.DateTime dateTime, DiGi.Log.Enums.LogRecordType logRecordType, string? text);

Parameters

dateTime System.DateTime

The timestamp of the log entry.

logRecordType LogRecordType

The type or severity of the log record.

text System.String

The descriptive text of the log message.

LogRecord(DateTime, string, LogRecordType, string) Constructor

Initializes a new instance of the LogRecord class with all specified values.

public LogRecord(System.DateTime dateTime, string? id, DiGi.Log.Enums.LogRecordType logRecordType, string? text);

Parameters

dateTime System.DateTime

The timestamp of the log entry.

id System.String

The unique identifier for the record.

logRecordType LogRecordType

The type or severity of the log record.

text System.String

The descriptive text of the log message.

LogRecord(JsonObject) Constructor

Initializes a new instance of the LogRecord class from a JSON object.

public LogRecord(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing record data.

Properties

LogRecord.DateTime Property

Gets the timestamp when the log record was created.

public System.DateTime DateTime { get; }

Implements DateTime

Property Value

System.DateTime

LogRecord.Id Property

Gets the unique identifier of the log record.

public string? Id { get; }

Implements Id

Property Value

System.String

LogRecord.LogRecordType Property

Gets the type or severity level of the log record.

public DiGi.Log.Enums.LogRecordType LogRecordType { get; }

Implements LogRecordType

Property Value

LogRecordType

LogRecord.Text Property

Gets the message text associated with the log record.

public string? Text { get; }

Implements Text

Property Value

System.String

Methods

LogRecord.Clone() Method

Creates a clone of the current log record.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A new DiGi.Core.Interfaces.ISerializableObject instance that is a copy of this record.

LogRecord.GetHashCode() Method

Returns a hash code for the current log record based on its string representation.

public override int GetHashCode();

Returns

System.Int32
An integer hash code.

LogRecord.ToString() Method

Returns a string representation of the log record, formatted with tabs.

public override string ToString();

Returns

System.String
A formatted string containing the date, ID (if available), type description, and text.

LogRecordProperties Class

Attribute used to define properties for a log record field.

public class LogRecordProperties : System.Attribute

Inheritance System.ObjectSystem.Attribute → LogRecordProperties

Constructors

LogRecordProperties(LogRecordType, string) Constructor

Initializes a new instance of the LogRecordProperties class.

public LogRecordProperties(DiGi.Log.Enums.LogRecordType logRecordType, string? text);

Parameters

logRecordType LogRecordType

The type of the log record.

text System.String

The descriptive text associated with the log record.

LogRecordProperties(string, LogRecordType, string) Constructor

Initializes a new instance of the LogRecordProperties class.

public LogRecordProperties(string? id, DiGi.Log.Enums.LogRecordType logRecordType, string? text);

Parameters

id System.String

The unique identifier for the log record property.

logRecordType LogRecordType

The type of the log record.

text System.String

The descriptive text associated with the log record.

Properties

LogRecordProperties.Id Property

Gets the unique identifier for the log record property.

public string? Id { get; }

Property Value

System.String

LogRecordProperties.LogRecordType Property

Gets the type of the log record.

public DiGi.Log.Enums.LogRecordType LogRecordType { get; }

Property Value

LogRecordType

LogRecordProperties.Text Property

Gets the descriptive text associated with the log record.

public string? Text { get; }

Property Value

System.String

Clone this wiki locally