/// <summary> /// Determines whether the log listener accepts the log entry for processing. /// </summary> /// <param name="entry">The log entry.</param> /// <returns>True if the log listener accepts the log entry for processing, otherwise false.</returns> public virtual bool Accepts(ILogEntry entry) { if (entry == null) { throw new ArgumentNullException("entry"); } if (!IsEnabled) { return(false); } return(Filter != null && Filter.Accepts(entry)); }
/// <summary> /// Writes the log entry into the underlying log. /// </summary> /// <param name="entry">The entry to log.</param> public override void Write(StandardLogEntry entry) { if (entry == null) { throw new ArgumentNullException("entry"); } if (Filter != null && !Filter.Accepts(entry)) { return; } var message = Formatter.Format(entry); switch (entry.Level) { case Level.Info: Log.Info(message); //// if (IsInfoEnabled) LoggingService.LogToLoggingService(entry, message); break; case Level.Warn: Log.Warn(message); //// if (IsWarnEnabled) LoggingService.LogToLoggingService(entry, message); break; case Level.Error: Log.Error(message); //// if (IsErrorEnabled) LoggingService.LogToLoggingService(entry, message); break; case Level.Fatal: Log.Fatal(message); //// if (IsFatalEnabled) LoggingService.LogToLoggingService(entry, message); break; default: Log.Debug(message); //// if (IsDebugEnabled) LoggingService.LogToLoggingService(entry, message); break; } }