Adapter for Microsoft.Extensions.Logging
Перейти к файлу
Eugene Sadovoi 2bd8f20ea5 Released Abstractions 4.1.0 2019-03-02 13:59:46 -05:00
src Released Abstractions 4.1.0 2019-03-02 13:59:46 -05:00
tests Released Abstractions 4.1.0 2019-03-02 13:59:46 -05:00
.gitignore Initial commit 2018-01-11 16:42:31 -05:00
LICENSE Initial commit 2018-01-11 16:42:31 -05:00
README.md Update README.md 2018-04-18 11:20:16 -04:00
appveyor.yml --framework net47 -- 2018-01-13 18:45:54 -05:00
package.props Released Abstractions 4.1.0 2019-03-02 13:59:46 -05:00
package.sln Releasing 5.9.0 2019-01-22 20:09:07 -05:00

README.md

Build status codecov License Build status NuGet

Microsoft.Extensions.Logging

Unity extension to integrate with Microsoft.Extensions.Logging.

Getting Started

Install-Package Unity.Microsoft.Logging 

Create and configure LoggerFactory

ILoggerFactory loggerFactory = new LoggerFactory();
loggerFactory.AddProvider(new ConsoleLoggerProvider((text, logLevel) => logLevel >= LogLevel.Debug, false));

Get the container

var container = new UnityContainer();

Register extension and pass it configured factory

container.AddExtension(new LoggingExtension(loggerFactory));

// Register few types
container.RegisterType<IService, Service>();

var service = container.Resolve<IService>();

For more information see this example