コード例 #1
0
        // internal for tests
        internal static HConsoleConfiguration GetConfig(object source)
        {
            if (SourceConfigs.TryGetValue(source, out var config))
            {
                config = config.Clone();
            }
            else
            {
                config = new HConsoleConfiguration();
            }

            var type = source.GetType();

            while (type != null && !config.IsComplete)
            {
                if (TypeConfigs.TryGetValue(type, out var c))
                {
                    config = config.Merge(c);
                }
                type = type.BaseType;
            }

            config = config.Merge(DefaultConfig);
            return(config);
        }
コード例 #2
0
        public HConsoleConfiguration Clone()
        {
            var clone = new HConsoleConfiguration();

            if (_hasIndent)
            {
                clone.SetIndent(Indent);
            }
            if (_hasPrefix)
            {
                clone.SetPrefix(Prefix);
            }
            if (_hasMaxLevel)
            {
                clone.SetMaxLevel(MaxLevel);
            }
            return(clone);
        }