Esempio n. 1
0
 public SimpleLogSettings()
 {
     Items   = new ConcurrentDictionary <string, SimpleLogSetting>(StringComparer.OrdinalIgnoreCase);
     Default = new SimpleLogSetting()
     {
         Category = DefaultCategory, EnabledLevel = SimpleLogLevel.Trace
     };
 }
Esempio n. 2
0
        public void SetEnabledLevel(string category, SimpleLogLevel level)
        {
            if (string.IsNullOrWhiteSpace(category))
            {
                throw new ArgumentNullException(nameof(category));
            }

            var key         = category.Trim();
            var tryGetValue = Items.TryGetValue(key, out var setting);

            if (!tryGetValue || setting == null)
            {
                setting          = new SimpleLogSetting();
                setting.Category = key;
                Items.Add(key, setting);
            }
            setting.EnabledLevel = level;
        }