コード例 #1
0
 internal ConsoleTarget(ConsoleTargetBuilder builder)
 {
     this.pattern    = ParsedLayout.Parse(builder.Layout, builder.LayoutMode);
     this.Layout     = builder.Layout;
     this.LayoutMode = builder.LayoutMode;
     this.colorMappings.AddMany(builder.ColorMappings);
     this.colorMappings.MakeReadOnly();
     this.colorMappingsCache = this.colorMappings.GetEffectiveColors();
     this.console            = new BclConsoleWrapper();
 }
コード例 #2
0
        internal LoggerLevelMap <ConsoleColors> GetEffectiveColors()
        {
            LoggerLevelMap <ConsoleColors> result
                = new LoggerLevelMap <ConsoleColors>(
                      new ConsoleColors {
                Foreground = null,
                Background = null
            });

            foreach (var mapping in this)
            {
                foreach (var level in mapping.Level.TrueValues())
                {
                    ConsoleColors cc = result[level];
                    result[level] =
                        new ConsoleColors(mapping.Foreground, mapping.Background);
                }
            }

            return(result);
        }