Fix intermitent bug with injecting ILogger

--HG--
branch : dev
This commit is contained in:
Renaud Paquay 2010-12-03 16:42:13 -08:00
parent ee31489a17
commit c4fb128c72
2 changed files with 4 additions and 3 deletions

View File

@ -9,7 +9,7 @@ namespace Orchard.Logging {
Fatal
}
public interface ILogger : ISingletonDependency {
public interface ILogger {
bool IsEnabled(LogLevel level);
void Log(LogLevel level, Exception exception, string format, params object[] args);
}

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
@ -14,7 +15,7 @@ namespace Orchard.Logging {
private readonly IDictionary<string, ILogger> _loggerCache;
public LoggingModule() {
_loggerCache = new Dictionary<string, ILogger>();
_loggerCache = new ConcurrentDictionary<string, ILogger>();
}
protected override void Load(ContainerBuilder moduleBuilder) {
@ -78,7 +79,7 @@ namespace Orchard.Logging {
else {
var propertyValue = ctx.Resolve<ILogger>(new TypedParameter(typeof(Type), componentType));
_loggerCache.Add(component, propertyValue);
propertyInfo.SetValue(instance, propertyValue, null);
propertyInfo.SetValue(instance, propertyValue, null);
}
};
}