Exemple #1
0
        public LoggerFacade(LoggerSettings settings)
        {
            var loggerChain = new List <AbstractLogger>();
            var logLevels   = Enum.GetValues(typeof(LogLevel)).Cast <LogLevel>();

            foreach (var level in logLevels)
            {
                if ((level & settings.LogLevel) == LogLevel.None)
                {
                    continue;
                }

                var strategy = settings.DefaultLogStrategy;
                if (settings.OverridenLogStrategies.ContainsKey(level))
                {
                    strategy = settings.OverridenLogStrategies[level];
                }

                var logger = new T().Init(level, strategy);

                if (loggerChain.Count > 0)
                {
                    loggerChain.Last().SetNextLogger(logger);
                }

                loggerChain.Add(logger);
            }

            _logger = loggerChain.First() ?? new T().Init(LogLevel.None, null);
        }
Exemple #2
0
 public void SetNextLogger(AbstractLogger nextLogger)
 {
     _nextLogger = nextLogger;
 }