Skip to content

Logging

Brian Lehnen edited this page Apr 9, 2021 · 5 revisions

Logging

A logging facade is used by the queue, defined as ILogger. To get logging, you must implement and inject a logger.

######Debug mode

A console logger is created by default. To change this, see 'Explictly assigning the log library' below.

######Release mode

No logger is explictly created. If you want logging you need to implement ILogger and inject your instance as a singleton.

Here is a serilog example

https://github.com/blehnen/DotNetWorkQueue/blob/master/Source/Samples/SampleShared/SerilogAdapter.cs

//log is a serilog instance
using (var createQueueContainer = new QueueCreationContainer<LiteDbMessageQueueInit>(serviceRegister =>
                serviceRegister.Register<DotNetWorkQueue.Logging.ILogger>(() => new SerilogAdapter(log), LifeStyles.Singleton)))

The integration tests uses a custom log provider to log errors - it can be found Here

Clone this wiki locally