Adapter for Microsoft.Extensions.Logging
Перейти к файлу
Eugene Sadovoi a8fa7999a7
Create FUNDING.yml
2021-06-14 10:04:57 -07:00
.github Create FUNDING.yml 2021-06-14 10:04:57 -07:00
src Copyright © .NET Foundation and Contributors. 2020-05-13 15:51:08 -07:00
tests Version update 2020-04-20 22:13:43 -07:00
.gitignore Initial commit 2018-01-11 16:42:31 -05:00
LICENSE Copyright © .NET Foundation and Contributors. 2020-05-13 15:51:08 -07:00
README.md Adding .Net Foundation links 2020-05-14 13:37:48 -07:00
appveyor.yml --framework net47 -- 2018-01-13 18:45:54 -05:00
package.props Releasing 5.11.1 2019-06-20 16:09:05 -04: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

Code of Conduct

This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information, see the .NET Foundation Code of Conduct

Contributing

See the Contributing guide for more information.

.NET Foundation

Unity Container is a .NET Foundation project