I’m a bit confused if Serilog creates it’s own ILOgger object or uses the .net core ILogger<T> can anyone help me please?
Serilog has its own set of interfaces, but there is a bridge into Microsoft.Extensions.Logging.
Is SeriLog based on the .Net Core ILogger interface?
No, but you can get an .NET Core ILogger
instance that wraps the serilog.
I think it’s in the package Serilog.AspNetCore
: https://github.com/serilog/serilog-aspnetcore (or Serilog.Extensions.Hosting
https://github.com/serilog/serilog-extensions-hosting , depending)
nlog, log4net and serilog can all be setup to work directly with c# ILogger interface via the DI, if that is of any use? Doing this decouples the logging from providers, allowing you to change down the line if you want. Serilog has its own ‘Log.XYZ()’ methods but its best to avoid them and set up propper logging via ILogger<> interfaces. The direct logging ‘Log.XYZ()’ is ok for very early prototypes and writing something down quickly and dirtily.
Thank you that’s a bit help, much appreciated
It implements that interface, along with others.
/u/rbatts94, I have found an error in your post:
“creates it’s [its] own ILOgger”
I suspect it was possible for you, rbatts94, to have said “creates it’s [its] own ILOgger” instead. ‘It’s’ means ‘it is’ or ‘it has’, but ‘its’ is possessive.
This is an automated bot. I do not intend to shame your mistakes. If you think the errors which I found are incorrect, please contact me through DMs or contact my owner EliteDaMyth!
C# devs
null reference exceptions