Example #1
0
 private void FindAnyEnabled()
 {
     lock (childrenLocker)
     {
         foreach (var level in levels)
         {
             childrenByLevel[level] = 0;
         }
         ILogger[] loggers = null;
         while (loggers == null)
         {
             try {
                 loggers = Logger.Repository.GetCurrentLoggers();
             } catch (InvalidOperationException) {
             }
         }
         for (var i = 0; i < loggers.Length; i++)
         {
             var child = loggers[i];
             foreach (var level in levels)
             {
                 if (child.IsEnabledFor(level))
                 {
                     if (child.Name.StartsWith(Logger.Name))
                     {
                         childrenByLevel[level]++;
                     }
                     else if (child.Name.Contains("*") || child.Name.Contains("?"))
                     {
                         var wildcard = new Wildcard(child.Name, RegexOptions.IgnoreCase);
                         if (wildcard.IsMatch(Logger.Name))
                         {
                             childrenByLevel[level]++;
                         }
                     }
                 }
             }
         }
     }
 }
Example #2
0
 private bool CheckAnyEnabled(Level level)
 {
     foreach (var child in Logger.Repository.GetCurrentLoggers())
     {
         if (child.Name.StartsWith(Logger.Name))
         {
             if (child.IsEnabledFor(level))
             {
                 return(true);
             }
         }
         var wildcard = new Wildcard(child.Name, RegexOptions.IgnoreCase);
         if (wildcard.IsMatch(Logger.Name))
         {
             if (child.IsEnabledFor(level))
             {
                 return(true);
             }
         }
     }
     return(false);
 }