Phase 7 Stream A.3 — ScriptLoggerFactory + ScriptLogCompanionSink (closes Stream A) #179
Reference in New Issue
Block a user
Delete Branch "phase-7-stream-a3-script-logger"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Third of 3 increments closing out Stream A. Library-level Serilog plumbing for per-script loggers + error-forwarding to the main log. Actual file-sink composition at server startup happens in Stream F / G; this PR ships the reusable building blocks.
ScriptLoggerFactory.Create(scriptName)returns anILoggerwithScriptNameproperty pre-bound viaForContextScriptNameProperty = "ScriptName"is a public const — the Admin UI's log-viewer filter references this exact string, so changing it is a breaking contract guarded by a dedicated testScriptLogCompanionSinkILogEventSinkthat mirrors Error+ events from the scripts pipeline to the main logger (opcua-*.log) at Warning level — operators see script failures in the primary log without drowning it in Debug/Info chatterScriptName+OriginalLevel+ exception for stack-trace diagnosisScriptNameproperty falls back to "unknown" defensivelyTests — 63/63 Core.Scripting
ScriptLoggerFactoryTests(6): Create binds ScriptName, per-script isolation, Error preserves level+exception, null/empty rejections, property-name const stabilityScriptLogCompanionSinkTests(9): Info/Warning NOT mirrored, Error/Fatal mirrored at Warning level, ScriptName+OriginalLevel+exception preserved on forward, missing-property fallback, null-logger rejected, custom threshold appliedStream A complete
63/63 green — 29 A.1 (sandbox + AST inference) + 19 A.2 (cache + timeout) + 15 A.3 (loggers). Streams B-G build on this foundation; Stream H closes out the phase.