示例#1
0
        public void Add(LoggingData loggingData)
        {
            lock (this.loggings)
            {
                LoggingEntry last = loggings.Count > 0 ? loggings[loggings.Count - 1] : null;
                if (last != null && last.IsMatch(loggingData))
                {
                    last.Add(loggingData);
                    this.UpdateCount(last.Level, 1);
                }
                else
                {
                    LoggingEntry logging = new LoggingEntry(loggingData);
                    loggings.Add(logging);
                    this.UpdateCount(logging.Level, 1);
                }

                if (loggings.Count > this.capacity)
                {
                    LoggingEntry oldest = loggings[0];
                    this.UpdateCount(oldest.Level, -1);
                    if (oldest.Count <= 1)
                    {
                        loggings.RemoveAt(0);
                    }
                    else
                    {
                        oldest.RemoveAt(0);
                    }
                }
            }
        }
示例#2
0
        bool ShouldShow(LoggingEntry logging)
        {
            if (!consoleVM.IsLevelShow(logging.Level))
            {
                return(false);
            }

            if (string.IsNullOrEmpty(consoleVM.FilterText))
            {
                return(true);
            }

            if (Regex.IsMatch(logging.Message, consoleVM.FilterText) || (consoleVM.IsColumnShow(Columns.Logger) && Regex.IsMatch(logging.LoggerName, consoleVM.FilterText)))
            {
                return(true);
            }

            return(false);
        }