All Projects → ziyasal → Autofac.Extras.NLog

ziyasal / Autofac.Extras.NLog

Licence: MIT license
An Autofac module to integrate Autofac and NLog, it supports both constructor and property injection.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to Autofac.Extras.NLog

di speed
Speed comparison of Dependency Injection Container
Stars: ✭ 18 (-62.5%)
Mutual labels:  dependency-injection, autofac
WebApiClient.Extensions
WebApiClient项目的第三方扩展:Autofac、DependencyInjection、HttpClientFactory、SteeltoeOSS.Discovery、MessagePack、Protobuf、Json-Rpc
Stars: ✭ 73 (+52.08%)
Mutual labels:  dependency-injection, autofac
Blog.core
💖 ASP.NET Core 6.0 全家桶教程,前后端分离后端接口,vue教程姊妹篇,官方文档:
Stars: ✭ 3,542 (+7279.17%)
Mutual labels:  dependency-injection, autofac
KickStart
Application initialization helper
Stars: ✭ 42 (-12.5%)
Mutual labels:  dependency-injection, autofac
Autofac
An addictive .NET IoC container
Stars: ✭ 3,713 (+7635.42%)
Mutual labels:  dependency-injection, autofac
Ulfberht
🗡️ A small but powerful & opinionated DI library. Written in Kotlin, and powered by annotation processing.
Stars: ✭ 234 (+387.5%)
Mutual labels:  dependency-injection
NLog.Targets.Syslog
A Syslog server target for NLog
Stars: ✭ 63 (+31.25%)
Mutual labels:  nlog
Dry System
Organize your code into reusable components
Stars: ✭ 228 (+375%)
Mutual labels:  dependency-injection
Angular Awesome List
Список ресурсов по Angular на русском
Stars: ✭ 224 (+366.67%)
Mutual labels:  dependency-injection
gocontainer
Simple Dependency Injection Container
Stars: ✭ 18 (-62.5%)
Mutual labels:  dependency-injection
StartupModules
Startup modules for ASP.NET Core.
Stars: ✭ 33 (-31.25%)
Mutual labels:  dependency-injection
Typhoon
Powerful dependency injection for Objective-C ✨✨ (https://PILGRIM.PH is the pure Swift successor to Typhoon!!)✨✨
Stars: ✭ 2,711 (+5547.92%)
Mutual labels:  dependency-injection
Grafter
Grafter is a library to configure and wire Scala applications
Stars: ✭ 240 (+400%)
Mutual labels:  dependency-injection
DI-compiler
A Custom Transformer for Typescript that enables compile-time Dependency Injection
Stars: ✭ 62 (+29.17%)
Mutual labels:  dependency-injection
Invoker
Generic and extensible callable invoker
Stars: ✭ 229 (+377.08%)
Mutual labels:  dependency-injection
stashbox
A lightweight, fast, and portable dependency injection framework for .NET-based solutions.
Stars: ✭ 120 (+150%)
Mutual labels:  dependency-injection
Transfuse
💉 Transfuse - A Dependency Injection and Integration framework for Google Android
Stars: ✭ 226 (+370.83%)
Mutual labels:  dependency-injection
Kotlin Inject
Dependency injection lib for kotlin
Stars: ✭ 248 (+416.67%)
Mutual labels:  dependency-injection
alice
An additive dependency injection container for Golang.
Stars: ✭ 51 (+6.25%)
Mutual labels:  dependency-injection
Typhoon Example
An example application built with Typhoon dependency injection framework.
Stars: ✭ 246 (+412.5%)
Mutual labels:  dependency-injection

Autofac Loggging Module for NLog

Build status

Nuget package available, to install run the following command;

Install-Package Autofac.Extras.NLog

Register NLogModule to Autofac

It attaches to Component Registration and creates logger for requested type.

containerBuilder.RegisterModule<NLogModule>();

Register SimpleNLogModule to Autofac

It is useful when ILogger resolved from Service Locator.

containerBuilder.RegisterModule<SimpleNLogModule>();

NLogModule and SimpleNLogModule supports both constructor and property injection.

  • Constructor sample
public class SampleClassWithConstructorDependency : ISampleInterface
{
    private readonly ILogger _logger;

    public SampleClassWithConstructorDependency(ILogger logger)
    {
      _logger = logger;
  }        
}
  • Property Sample
public class SampleClassWithPropertyDependency : ISampleInterface
{
   public ILogger Logger { get; set; }
}
  • Service Locator Sample
 public class SampleClassToResolveLoggerFromServiceLocator : ISampleClass
    {
        private readonly ILogger _logger;
        
        public SampleClassToResolveLoggerFromServiceLocator(ILifetimeScope serviceLocator)
        {
            _logger = serviceLocator.Resolve<ILogger>();
        }
    }
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].