Skip to content

Repository files navigation

Build statusLicenseNuGetNuGet

NLog adapter for Unity container

Unity extension to integrate with popular NLog logger.

Getting Started

  • Reference the Unity.NLog package from NuGet.
Install-Package Unity.NLog

Registration:

  • Add NLogExtension extension to the container
container=newUnityContainer();container.AddNewExtension<NLogExtension>();
  • Where required add ILogger interface to resolved constructor.
publicclassLoggedType{publicLoggedType(ILoggerlog){}
...}
  • If you want to custom the extension (In this case, get only the class name instead of the full name), you have to instantiate NLogExtension to set properties and add this extension to Unity
varext=newNLogExtension{GetName=(t,n)=>t.Name};container.AddExtension(ext);
  • Log normally...

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

About

Adapter for NLog

Resources

Stars

21 stars

Watchers

5 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages