예제 #1
0
        private static bool WriteToTargetWithFilterChain(TargetWithFilterChain targetListHead, LogEventInfo logEvent, AsyncContinuation onException, bool clone)
        {
            Target       target = targetListHead.Target;
            FilterResult result = GetFilterResult(targetListHead.FilterChain, logEvent);

            if ((result == FilterResult.Ignore) || (result == FilterResult.IgnoreFinal))
            {
                if (InternalLogger.IsDebugEnabled)
                {
                    InternalLogger.Debug("{0}.{1} Rejecting message because of a filter.", logEvent.LoggerName, logEvent.Level);
                }

                if (result == FilterResult.IgnoreFinal)
                {
                    return(false);
                }

                return(true);
            }

            target.WriteAsyncLogEvent(clone ? logEvent.Clone().WithContinuation(onException) : logEvent.WithContinuation(onException));

            if (result == FilterResult.LogFinal)
            {
                return(false);
            }

            return(true);
        }