-
Notifications
You must be signed in to change notification settings - Fork 16
Logging
Brian Lehnen edited this page Jan 12, 2022
·
5 revisions
Microsoft.Extensions.Logging.Abstractions is used for the logging abstraction.
No logger is explictly created; the queue uses the Null logger if nothing is set by the caller. If you want logging you need to inject your instance of ILoggerFactory as a singleton.
Here is a simple serilog example
var log = new LoggerConfiguration()
.WriteTo.Console()
.MinimumLevel.Debug()
.CreateLogger();
Log.Logger = log;
//NOTE - Serilog requires that you configure and setup serilog before creating the logging factory
var loggerFactory = LoggerFactory.Create(builder =>
{
builder.AddFilter(level => level >= LogLevel.Debug)
.AddSerilog();
}
);
//when obtaining a queuecontainer, register the logging factory
container.Register<ILoggerFactory>(() => loggerFactory, LifeStyles.Singleton);
The integration tests uses a custom log provider to log errors - it can be found Here
For any issues please use the GitHub issues