Struct LogEntry
Represents a fully formatted log entry with all components pre-processed and ready for output. Instances are created by Log and dispatched to every registered ILogReceiver so that formatting work is performed exactly once regardless of how many receivers are active.
Inherited Members
Namespace: Scylla.Core
Assembly: ScyllaCore.dll
Syntax
public readonly struct LogEntry
Remarks
LogEntry is an immutable value type (readonly struct). All string fields are
pre-formatted by Log before the struct is constructed, including dynamic
column padding supplied by Scylla.Core.LogFormatter. Receivers must not reformat or
mutate any of the fields; they should compose their output directly from the provided
strings.
The pre-formatting pattern avoids redundant string.Format or StringBuilder
calls inside each receiver's LogData(LogEntry) implementation. A receiver
that writes to a file and another that writes to the Unity console both receive the exact
same pre-padded strings and can concatenate them without additional processing.
Receivers that need the raw, unformatted value (for example, a JSON telemetry sink) may read OriginalData directly instead of parsing DataString.
Constructors
LogEntry(string, string, string, string, object, LogLevel, LogCategory, string, int, string)
Initializes a new LogEntry with all pre-formatted log components. This constructor is called internally by Log after all formatting and padding has been applied; it should not be called directly from application code.
Declaration
public LogEntry(string prefix, string paddedLabel, string paddedCategory, string dataString, object originalData, LogLevel level, LogCategory category, string filePath = "", int lineNumber = 0, string timestamp = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | prefix | The application-level log prefix string, for example |
| string | paddedLabel | The severity label padded to the current maximum label width, for example
|
| string | paddedCategory | The category label padded to the current maximum category width, for example
|
| string | dataString | The string representation of the logged value. Pass |
| object | originalData | The raw object that was passed to the originating Log method call. May be
|
| LogLevel | level | The LogLevel severity of the message, as specified by the caller. |
| LogCategory | category | The LogCategory subsystem classification of the message, as specified by the caller. |
| string | filePath | The full source file path captured by |
| int | lineNumber | The source line number captured by |
| string | timestamp | An explicit timestamp string in |
Remarks
The automatic timestamp fallback (Now when timestamp
is null or empty) means the recorded time reflects when the LogEntry
was constructed, not when it is eventually consumed by a receiver. For buffered log
scenarios - where entries are queued before receivers are registered - the timestamp
therefore correctly captures the original log time rather than the replay time.
Fields
Category
The subsystem category of this log entry, as specified by the caller. This value corresponds to the bracketed label stored in PaddedCategory. Receivers may use this field to route entries to category-specific outputs or apply category-based filtering.
Declaration
public readonly LogCategory Category
Field Value
| Type | Description |
|---|---|
| LogCategory |
DataString
The human-readable string representation of the logged value, produced by calling
ToString() on OriginalData. If OriginalData was
null at the time of the log call, this field contains the literal string
"Null". Receivers should use this field to write the message body.
Declaration
public readonly string DataString
Field Value
| Type | Description |
|---|---|
| string |
FilePath
The full file system path of the source file in which the Log call was made,
captured automatically via [CallerFilePath]. On most platforms this is the absolute
path on the build machine, for example
C:\Projects\Scylla\Assets\Scylla\Framework\Core\Runtime\Debug\Logger\Log.cs.
This field is an empty string when compiler caller-info attributes are unavailable.
Receivers that include a source location column (such as a file log) typically extract
only the filename from this path.
Declaration
public readonly string FilePath
Field Value
| Type | Description |
|---|---|
| string |
Level
The severity level of this log entry, as specified by the caller. Receivers may use this value to apply per-level formatting (for example, coloring errors red) or to filter entries below a minimum threshold before writing them to their output target.
Declaration
public readonly LogLevel Level
Field Value
| Type | Description |
|---|---|
| LogLevel |
LineNumber
The one-based line number within FilePath at which the Log
call was made, captured automatically via [CallerLineNumber]. This field is
0 when compiler caller-info attributes are unavailable. Together with
FilePath, it forms the source location token displayed in log output,
for example [Log.cs:142].
Declaration
public readonly int LineNumber
Field Value
| Type | Description |
|---|---|
| int |
OriginalData
The original, unformatted object that was passed to the Log method.
This field preserves the object reference for receivers that require access to the
underlying value rather than its string form - for example, a structured logging
sink that serializes the object directly to JSON. May be null if the caller
logged a null value.
Declaration
public readonly object OriginalData
Field Value
| Type | Description |
|---|---|
| object |
PaddedCategory
The log category label, padded with trailing spaces so that all categories in a session
occupy the same column width, for example [Core] or [Analytics] .
The padding is computed by GetPaddedCategory(string) and grows
dynamically if a longer category name is encountered later in the session.
This field is an empty string when Category is None
or when the receiver has opted to suppress the category column.
Declaration
public readonly string PaddedCategory
Field Value
| Type | Description |
|---|---|
| string |
PaddedLabel
The log severity label, padded with trailing spaces so that all labels in a session
occupy the same column width, for example [WARNING] or [DEBUG] .
The padding is computed by GetPaddedLabel(string) and grows
dynamically if a longer label is encountered later in the session.
This field is an empty string when the LogLabelLevel threshold
has not been reached for the active receiver, meaning the receiver has opted to suppress
the label column at this severity.
Declaration
public readonly string PaddedLabel
Field Value
| Type | Description |
|---|---|
| string |
Prefix
The application-level log prefix that identifies the framework in output lines,
for example [Scylla]. This value originates from LOG_PREFIX
and is supplied by the ILogReceiver that registered the prefix via
LogPrefix.
Declaration
public readonly string Prefix
Field Value
| Type | Description |
|---|---|
| string |
Timestamp
The wall-clock timestamp at which this log entry was created, formatted as
yyyy-MM-dd HH:mm:ss.fff (for example, 2026-03-12 14:05:32.417).
The value is set to Now at construction time when no explicit
timestamp is provided. Receivers that write to persistent outputs such as log files
should include this field to enable post-session analysis.
Declaration
public readonly string Timestamp
Field Value
| Type | Description |
|---|---|
| string |