a8fa7999a7 | ||
---|---|---|
.github | ||
src | ||
tests | ||
.gitignore | ||
LICENSE | ||
README.md | ||
appveyor.yml | ||
package.props | ||
package.sln |
README.md
Microsoft.Extensions.Logging
Unity extension to integrate with Microsoft.Extensions.Logging.
Getting Started
- Reference the Unity.Microsoft.Logging package from NuGet.
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