Class UnityStructuredLogService
Unity-specific structured logging service that extends UnityLogService with persistence into
a queryable IStructuredStore backend.
Writes each log entry as a StructuredRecord, optionally trimming the configured
stream to its newest N records after every insert. A failed write never escapes and never
re-enters ILogService — it is reported via
UnityEngine.Debug.LogError(System.Object) directly, so a down Http/Mongo backend cannot recurse into
this same sink.
Namespace: Serenity.StructuredLogging.Infrastructure.Services
Assembly: Serenity.UnityStructuredLogging.Infrastructure.dll
Syntax
public class UnityStructuredLogService : UnityLogService
Constructors
UnityStructuredLogService()
Declaration
public UnityStructuredLogService()
Methods
Initialize(CreateLogServiceDTO)
Initializes the structured log service with its resolved store, table, and retention
configuration.
Casts input DTO to CreateStructuredLogServiceDTO, validates the store
dependency, and calls base Initialize for log formatting configuration.
Declaration
public override void Initialize(CreateLogServiceDTO input)
Parameters
| Type | Name | Description |
|---|---|---|
| CreateLogServiceDTO | input | CreateStructuredLogServiceDTO containing the store, table, and retention dependencies. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when the resolved store is null. |
WriteLog(LogEntry)
Writes a log entry into the configured structured store, trimming the stream to its
newest MaxRecords when configured, then optionally echoes it to the console.
Entries logged under this service's own category are never persisted — only mirrored —
so a store failure reported by a caller under that category cannot recurse into another
insert attempt against the same failing store.
Declaration
public override void WriteLog(LogEntry entry)
Parameters
| Type | Name | Description |
|---|---|---|
| LogEntry | entry | LogEntry containing message, severity, category, tags, and optional exception. |