Skip to content

Latest commit

 

History

History
55 lines (35 loc) · 2.3 KB

README.md

File metadata and controls

55 lines (35 loc) · 2.3 KB

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