You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, Wanted to inject ITestOutputHelper outputHelper (received in test class constructor) in order to write logs to xuint output, so I need this instance to configure my serilog logger sink.
Don't know how to do it from the static method, since it's executed before my constructor
Hi, Wanted to inject ITestOutputHelper outputHelper (received in test class constructor) in order to write logs to xuint output, so I need this instance to configure my serilog logger sink.
Don't know how to do it from the static method, since it's executed before my constructor
serviceRegistry.Register<Serilog.ILogger>(factory =>
{
const string logTemplate =
"[{Timestamp:HH:mm:ss.fff%K} | {SourceContext}] | [{Level:u3}]{NewLine}{Message:lj}{NewLine}{Exception}";
var logger = new Serilog.LoggerConfiguration()
.MinimumLevel.Is(LogEventLevel.Error)
.Enrich.FromLogContext()
.WriteTo.Trace(outputTemplate: logTemplate)
.WriteTo.Console(outputTemplate: logTemplate)
.WriteTo.TestOutput(factory.GetInstance(),restrictedToMinimumLevel:LogEventLevel.Verbose, outputTemplate:logTemplate)
.CreateLogger();
return logger;
});
The text was updated successfully, but these errors were encountered: