Example #1
0
 /// <summary>
 /// Checks whether log event should be logged or not.
 /// </summary>
 /// <param name="logEvent">Log event.</param>
 /// <returns>
 /// <see cref="FilterResult.Ignore"/> - if the log event should be ignored<br/>
 /// <see cref="FilterResult.Neutral"/> - if the filter doesn't want to decide<br/>
 /// <see cref="FilterResult.Log"/> - if the log event should be logged<br/>
 /// </returns>
 protected internal override FilterResult Check(LogEventInfo logEvent)
 {
     if (IgnoreCase)
     {
         if (CompiledLayout.GetFormattedMessage(logEvent).ToLower().IndexOf(Substring.ToLower()) < 0)
         {
             return(Result);
         }
         else
         {
             return(FilterResult.Neutral);
         }
     }
     else
     {
         if (CompiledLayout.GetFormattedMessage(logEvent).IndexOf(Substring) < 0)
         {
             return(Result);
         }
         else
         {
             return(FilterResult.Neutral);
         }
     }
 }