Skip to content

Latest commit

 

History

History
40 lines (22 loc) · 1.07 KB

README.md

File metadata and controls

40 lines (22 loc) · 1.07 KB

MhLabs.Extensions.Logging

Usage

This is a NuGet package that can be used in order to achieve logging by using ILogger<T> from Microsoft.Extensions.Logging.

LoggingProvider

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.

Examples

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");