fix(scripting): explicit companion logger + disposable ScriptRootLogger (T2 review)
This commit is contained in:
@@ -27,12 +27,19 @@ public static class ScriptRootLoggerFactory
|
||||
/// Minimum level for events forwarded to the <c>script-logs</c> topic; lower-level events
|
||||
/// still land in the file sink but are not pushed onto the cluster bus.
|
||||
/// </param>
|
||||
/// <param name="companionLogger">
|
||||
/// The application's main logger that receives mirrored Error-or-higher script events at
|
||||
/// Warning level. Passed explicitly so callers control the source rather than reading the
|
||||
/// global <see cref="Serilog.Log.Logger"/> static inside the factory.
|
||||
/// </param>
|
||||
/// <returns>The composed root script logger.</returns>
|
||||
public static Serilog.ILogger Build(IScriptLogPublisher publisher, string filePath, LogEventLevel topicMinLevel)
|
||||
public static Serilog.Core.Logger Build(
|
||||
IScriptLogPublisher publisher, string filePath, LogEventLevel topicMinLevel,
|
||||
Serilog.ILogger companionLogger)
|
||||
=> new LoggerConfiguration()
|
||||
.MinimumLevel.Verbose()
|
||||
.WriteTo.File(filePath, rollingInterval: RollingInterval.Day)
|
||||
.WriteTo.Sink(new ScriptLogCompanionSink(Serilog.Log.Logger))
|
||||
.WriteTo.Sink(new ScriptLogCompanionSink(companionLogger))
|
||||
.WriteTo.Sink(new ScriptLogTopicSink(publisher, topicMinLevel))
|
||||
.CreateLogger();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user