About .NET, ASP.NET, MVC, C#, WPF, WCF and everything related to .NET and more.

Mugen Injection [Logging]

The MugenInjection.Logging is a extension provided to allow loggers to be injected into your classes automatically.
Currently, only two logging frameworks are supported:

Getting Started

When using the logging extension, you can have the logger injected in a number of ways. In order to setup logging, you just need to declare the logger in your class according to how you want it injected, and make sure you have the IInjector load a Log4NetModule or NLogModule before requesting the type instance (by default IInjector automatically load system modules).
Injected through the constructor:
public class Alpha
        public Alpha( ILogger logger )
            Logger = logger;

        public ILogger Logger { get; private set; }
Injected into a property:
public class Alpha
        public ILogger Logger { get; set; }
Request a logger:
// Create your MugenInjector.
_injector = new MugenInjector();
var logger = _injector.Get<ILogger>();
var logger1 = _injector.GetLogger();
var logger2 = _injector.GetLogger(typeof(Program));

Leave a Reply
* Bullet List
** Bullet List 2
# Number List
## Number List 2
{"Do not apply formatting"}
{code:language} code here {code:language}.
Supports: aspx c#, c#, c++, html, sql, xml