This is a NuGet
package that can be used in order to achieve logging by using ILogger<T>
from Microsoft.Extensions.Logging.
The implemented LoggingProvider
is using SeriLog.
As a consumer of this library you will not be able to access SeriLog types, It's can only be accessed internally in the library by design.
var serviceProvider = new ServiceCollection()
.AddMhLogging()
.Build();
ILogger<MyService> logger = serviceProvider.GetRequiredService<ILogger<MyService>>();
logger.LogInformation("Hello World");
You can also configure the logger.
var serviceProvider = new ServiceCollection()
.AddMhLogging(x => x.EnableStructuredException())
.Build();
ILogger<MyService> logger = serviceProvider.GetRequiredService<ILogger<MyService>>);
logger.LogInformation("Hello World");