public void AddHiddenMessage(string message)
        {
            string result = FixMessage(message);

            if (result != string.Empty)
            {
                if (HiddenMessages.Contains(result) == false)
                {
                    HiddenMessages.Add(message);
                }
            }
        }
示例#2
0
        public void AddHiddenMessage(string message)
        {
            message =
                message.Fix();

            if (message.Length == 0)
            {
                return;
            }

            if (HiddenMessages.Contains(message))
            {
                return;
            }

            HiddenMessages.Add(message);
        }
示例#3
0
        public bool EventIsHidden(ILogEvent logEvent)
        {
            var context = logEvent.Context;

            if (context.ShowEvents != ShowEvents.Unknown)
            {
                return(context.ShowEvents == ShowEvents.Yes ? false : true);
            }

            var isHidden = (!ReferenceEquals(logEvent, ReferenceLogEvent)) && HiddenMessages.Contains(logEvent.Message);

            if (!isHidden)
            {
                foreach (var eventContext in _cachedContexts)
                {
                    if (eventContext.ShowEvents == ShowEvents.HideThisAndChildren)
                    {
                        if (eventContext.IsEqualOrParentOf(context))
                        {
                            isHidden           = true;
                            context.ShowEvents = ShowEvents.HideThisAndChildren;
                            break;
                        }
                    }
                }
            }

            if (context.ShowEvents != ShowEvents.Yes)
            {
                if (!_cachedContexts.Contains(context))
                {
                    _cachedContexts.Add(context);
                }

                if (!_hiddenContextsCache.Contains(context))
                {
                    _hiddenContextsCache.Add(context);
                }
            }

            return(isHidden);
        }