コード例 #1
0
        public void Build(IHierarchicalConfiguration config)
        {
            var oldRoot = _root;
            var newRoot = new Node();

            foreach (var loggerWithAppenders in CreateLoggersWithAppenders(config).OrderBy(x => x.logger.Name))
            {
                AddNode(newRoot, loggerWithAppenders.logger, loggerWithAppenders.appenders);
            }

            ApplyEncodingToAllAppenders(newRoot);

            _root = newRoot;

            Updated();

            oldRoot?.Dispose();
        }
コード例 #2
0
        private static List <(LoggerDefinition logger, IAppender[] appenders)> CreateLoggersWithAppenders(IHierarchicalConfiguration config)
        {
            var appendersByNames = config.Appenders.ToDictionary(x => x.Name, CreateAppender);

            var loggerWithAppenders = new List <(LoggerDefinition, IAppender[])>();