Skip to content

unitycontainer/microsoft-logging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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