feat(scripting): root script logger + DPS publisher wired in Host

This commit is contained in:
Joseph Doherty
2026-06-10 11:50:50 -04:00
parent 14fe88fc80
commit 73014258ef
8 changed files with 326 additions and 0 deletions
@@ -0,0 +1,25 @@
namespace ZB.MOM.WW.OtOpcUa.Core.Scripting;
/// <summary>
/// DI-friendly holder for the root script <see cref="Serilog.ILogger"/> so it can be
/// injected into the Roslyn evaluators without clashing with the application's main
/// <c>Serilog.Log.Logger</c> (both are <see cref="Serilog.ILogger"/>; a wrapper type
/// gives the container an unambiguous registration to resolve).
/// </summary>
/// <remarks>
/// The wrapped logger is the composed script pipeline — a rolling <c>scripts-*.log</c>
/// file sink, the <see cref="ScriptLogCompanionSink"/> mirroring errors to the main log,
/// and the <see cref="ScriptLogTopicSink"/> fanning entries onto the cluster
/// <c>script-logs</c> topic for the live Script-log Admin UI page.
/// </remarks>
public sealed class ScriptRootLogger
{
/// <summary>Gets the composed root script logger that evaluators derive per-script loggers from.</summary>
public Serilog.ILogger Logger { get; }
/// <summary>Initializes a new instance of the <see cref="ScriptRootLogger"/> class.</summary>
/// <param name="logger">The composed root script logger. Must not be <c>null</c>.</param>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="logger"/> is <c>null</c>.</exception>
public ScriptRootLogger(Serilog.ILogger logger) =>
Logger = logger ?? throw new ArgumentNullException(nameof(logger));
}