Ejemplo n.º 1
0
        internal static BaseLogger CreateInstance(LogElement logElement)
        {
            if (_instance == null)
            {
                Type providerType = Type.GetType(logElement.ProviderType);
                if (providerType == null)
                    throw new InvalidConfigurationException("Could not locate Log Provider :" + logElement.ProviderType);

                if (!providerType.ImplementsClass<BaseLogger>())
                    throw new InvalidConfigurationException("Log Provider does not implement ILogger:" +
                                                            logElement.ProviderType);

                var args = new CommandArgs(logElement.Parameters);
                _instance = (BaseLogger) Activator.CreateInstance(providerType, args);
            }

            return _instance;
        }
Ejemplo n.º 2
0
 public static IContext CreateDefault(BaseLogger baseLogger, IArguments arguments, BaseCacheStore cacheStore)
 {
     return _defaultContext ?? (_defaultContext = new CurrentContext(baseLogger, arguments, cacheStore));
 }
Ejemplo n.º 3
0
 private CurrentContext(BaseLogger baseLogger, IArguments arguments, BaseCacheStore cacheStore)
 {
     Log = baseLogger;
     ApplicationParams = arguments;
     Cache = cacheStore;
 }