mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 14:03:29 -07:00
replaced autofac with TinyIoC
This commit is contained in:
parent
bcc20fc8a1
commit
aacc53d882
36 changed files with 4286 additions and 406 deletions
|
@ -1,29 +0,0 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Autofac;
|
||||
using Autofac.Core;
|
||||
using NLog;
|
||||
|
||||
namespace NzbDrone.Core.Instrumentation
|
||||
{
|
||||
public class LogInjectionModule : Module
|
||||
{
|
||||
protected override void AttachToComponentRegistration(IComponentRegistry registry, IComponentRegistration registration)
|
||||
{
|
||||
registration.Preparing += OnComponentPreparing;
|
||||
}
|
||||
|
||||
static void OnComponentPreparing(object sender, PreparingEventArgs e)
|
||||
{
|
||||
e.Parameters = e.Parameters.Union(new[]
|
||||
{
|
||||
new ResolvedParameter((p, i) => p.ParameterType == typeof(Logger), (p,i)=> GetLogger(p.Member.DeclaringType))
|
||||
});
|
||||
}
|
||||
|
||||
private static object GetLogger(Type type)
|
||||
{
|
||||
return LogManager.GetLogger(type.Name);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue