Esempio n. 1
0
        public bool Match(LogEntry log)
        {
            bool stat = false;
            int MatchCount = 0;

            Filters.Iterate(delegate(LogFilter filter)
            {
                if (filter.Match(log))
                {
                    if (LinkWithAnd)
                    {
                        MatchCount++;
                        return false;
                    }

                    stat = true;
                    return true;
                }

                return false;
            });

            if (LinkWithAnd && Filters.Count == MatchCount)
                stat = true;

            return stat;
        }
Esempio n. 2
0
 public bool Match(LogEntry log)
 {
     switch (Sect)
     {
         case FilterSection.LogTypeSection:
             return DoMatchForLogType(log.Type);
         case FilterSection.TagSection:
             return DoMatchForString(log.Tag);
         case FilterSection.PidSection:
             return DoMatchForInt(log.ProcessId);
         case FilterSection.MessageSection:
             return DoMatchForString(log.Message);
         default:
             return false;
     }
 }
Esempio n. 3
0
        public static LogEntry Parse(string LogLine)
        {
            Regex rg = new Regex("([DVIWE])/(.*?) ?\\((.*?)\\): (.*)");
            Match m = rg.Match(LogLine);
            LogEntry LogObj = null;
            char type;
            string tag;
            int pid;
            string msg;

            if (m.Groups.Count == 5)
            {
                type = m.Groups[1].Value[0];
                tag = m.Groups[2].Value;

                try
                {
                    pid = int.Parse(m.Groups[3].Value.Trim());
                }
                catch
                {
                    return null;
                }

                msg = m.Groups[4].Value;

                try
                {
                    LogObj = new LogEntry(type, tag, pid, msg);
                }
                catch { }
            }

            return LogObj;
        }
Esempio n. 4
0
 public void AddEntry(LogEntry entry)
 {
     Entires.Add(entry);
 }