Esempio n. 1
0
 private LogMessageFilter EventAndType()
 {
     var filter = new LogMessageFilter();
     filter.EventName = new StringMatching(StringMatchingMode.Exact, m_log.EventName);
     filter.Type = new StringMatching(StringMatchingMode.Exact, m_log.TypeName);
     return filter;
 }
Esempio n. 2
0
 private LogMessageFilter EventAndAssembly()
 {
     var filter = new LogMessageFilter();
     filter.EventName = new StringMatching(StringMatchingMode.Exact, m_log.EventName);
     filter.Assembly = new StringMatching(StringMatchingMode.Exact, m_log.AssemblyName);
     return filter;
 }
        public FilterEditorDialog(LogMessage message, LogMessageFilter filter)
        {
            if (message == null)
                throw new ArgumentNullException(nameof(message));
            if (filter == null)
                throw new ArgumentNullException(nameof(filter));

            m_sampleMessage = message;
            m_filter = new LogMessageFilter();
            m_filter.FilterLevel = filter.FilterLevel;
            m_filter.TimeFilter = filter.TimeFilter ?? new TimestampMatching(TimestampMatchingMode.Inside, message.UtcTime.AddMinutes(-1), message.UtcTime.AddMinutes(1));
            m_filter.Classification = filter.Classification ?? new EnumMatchingFlags(EnumMatchingFlagsMode.Any, 1 << (int)message.Classification, message.Classification.ToString());
            m_filter.Level = filter.Level ?? new EnumMatchingFlags(EnumMatchingFlagsMode.Any, 1 << (int)message.Level, message.Level.ToString());
            m_filter.Flags = filter.Flags ?? new EnumMatchingFlags(EnumMatchingFlagsMode.All, (int)message.Flags, message.Flags.ToString());
            m_filter.Assembly = filter.Assembly ?? new StringMatching(StringMatchingMode.Exact, message.AssemblyName);
            m_filter.Type = filter.Type ?? new StringMatching(StringMatchingMode.Exact, message.TypeName);
            m_filter.RelatedType = filter.RelatedType ?? new StringMatching(StringMatchingMode.Exact, message.TypeName);
            m_filter.StackDetails = filter.StackDetails ?? new StackDetailsMatching();
            m_filter.StackTraceDetails = filter.StackTraceDetails ?? new StackTraceMatching();
            m_filter.EventName = filter.EventName ?? new StringMatching(StringMatchingMode.Exact, message.EventName);
            m_filter.MessageText = filter.MessageText ?? new StringMatching(StringMatchingMode.Exact, message.Message);
            m_filter.DetailsText = filter.DetailsText ?? new StringMatching(StringMatchingMode.Exact, message.Details);
            m_filter.ExceptionText = filter.ExceptionText ?? new StringMatching(StringMatchingMode.Exact, message.ExceptionString);

            InitializeComponent();

            chkTime.Checked = filter.TimeFilter != null;
            chkClass.Checked = filter.Classification != null;
            chkLevel.Checked = filter.Level != null;
            chkFlags.Checked = filter.Flags != null;
            chkAssembly.Checked = filter.Assembly != null;
            chkType.Checked = filter.Type != null;
            chkRelatedType.Checked = filter.RelatedType != null;
            chkStackDetails.Checked = filter.StackDetails != null;
            chkStackTrace.Checked = filter.StackTraceDetails != null;
            chkEventName.Checked = filter.EventName != null;
            chkMessage.Checked = filter.MessageText != null;
            chkDetails.Checked = filter.DetailsText != null;
            chkException.Checked = filter.ExceptionText != null;

            lblTime.Text = m_filter.TimeFilter.ToString();
            lblClass.Text = m_filter.Classification.ToString();
            lblLevel.Text = m_filter.Level.ToString();
            lblFlags.Text = m_filter.Flags.ToString();
            lblAssembly.Text = m_filter.Assembly.ToString();
            lblType.Text = m_filter.Type.ToString();
            lblRelatedType.Text = m_filter.RelatedType.ToString();
            lblStackDetails.Text = m_filter.StackDetails.ToString();
            lblStackTrace.Text = m_filter.StackTraceDetails.ToString();
            lblEventName.Text = m_filter.EventName.ToString();
            lblMessage.Text = m_filter.MessageText.ToString();
            lblDetails.Text = m_filter.DetailsText.ToString();
            lblException.Text = m_filter.ExceptionText.ToString();

            cmbVerbose.SelectedIndex = (int)m_filter.FilterLevel;
            chkMessage.Checked = filter.MessageText != null;
            chkMessage.Tag = filter.MessageText ?? new StringMatching(StringMatchingMode.Exact, message.Message);
        }
Esempio n. 4
0
 private LogMessageFilter ExcludeRelatedType()
 {
     using (var frm = new RelatedTypesFilter(m_log.EventPublisherDetails.TypeData))
     {
         if (frm.ShowDialog() == DialogResult.OK)
         {
             var filter = new LogMessageFilter();
             filter.RelatedType = new StringMatching(StringMatchingMode.Exact, frm.SelectedItem);
             return filter;
         }
         return null;
     }
 }
Esempio n. 5
0
 private LogMessageFilter Message()
 {
     using (var frm = new StringMatchingFilterDialog(new StringMatching(StringMatchingMode.Exact, m_log.Message)))
     {
         if (frm.ShowDialog() == DialogResult.OK)
         {
             var filter = new LogMessageFilter();
             filter.MessageText = frm.ResultFilter;
             return filter;
         }
         return null;
     }
 }
 private LogMessageFilter MessageAndEvent()
 {
     using (var frm = new StringMatchingFilterDialog(new StringMatching(StringMatchingMode.Exact, m_log.ExceptionString)))
     {
         if (frm.ShowDialog() == DialogResult.OK)
         {
             var filter = new LogMessageFilter();
             filter.ExceptionText = frm.ResultFilter;
             filter.EventName = new StringMatching(StringMatchingMode.Exact, m_log.EventName);
             return filter;
         }
         return null;
     }
 }
 private LogMessageFilter ExcludeBeforeAndAfter()
 {
     var filter = new LogMessageFilter();
     filter.TimeFilter = new TimestampMatching(TimestampMatchingMode.After, m_minTime.AddMinutes(-3), m_minTime.AddMinutes(1));
     return filter;
 }
 private LogMessageFilter Exclude5After()
 {
     var filter = new LogMessageFilter();
     filter.TimeFilter = new TimestampMatching(TimestampMatchingMode.After, m_minTime.AddMinutes(5), m_maxTime);
     return filter;
 }
 private LogMessageFilter ExcludeBefore()
 {
     var filter = new LogMessageFilter();
     filter.TimeFilter = new TimestampMatching(TimestampMatchingMode.Before, m_minTime, m_maxTime);
     return filter;
 }
        private void BtnOK_Click(object sender, EventArgs e)
        {
            FilterResult = new LogMessageFilter();
            FilterResult.FilterLevel = (FilterLevel)cmbVerbose.SelectedIndex;

            if (chkTime.Checked) FilterResult.TimeFilter = m_filter.TimeFilter;
            if (chkClass.Checked) FilterResult.Classification = m_filter.Classification;
            if (chkLevel.Checked) FilterResult.Level = m_filter.Level;
            if (chkFlags.Checked) FilterResult.Flags = m_filter.Flags;
            if (chkAssembly.Checked) FilterResult.Assembly = m_filter.Assembly;
            if (chkType.Checked) FilterResult.Type = m_filter.Type;
            if (chkRelatedType.Checked) FilterResult.RelatedType = m_filter.RelatedType;
            if (chkStackDetails.Checked) FilterResult.StackDetails = m_filter.StackDetails;
            if (chkStackTrace.Checked) FilterResult.StackTraceDetails = m_filter.StackTraceDetails;
            if (chkEventName.Checked) FilterResult.EventName = m_filter.EventName;
            if (chkMessage.Checked) FilterResult.MessageText = m_filter.MessageText;
            if (chkDetails.Checked) FilterResult.DetailsText = m_filter.DetailsText;
            if (chkException.Checked) FilterResult.ExceptionText = m_filter.ExceptionText;

            DialogResult = DialogResult.OK;
        }
Esempio n. 11
0
 private LogMessageFilter MessageAndRelatedType()
 {
     using (var frm = new RelatedTypesFilter(m_log.EventPublisherDetails.TypeData))
     {
         if (frm.ShowDialog() == DialogResult.OK)
         {
             using (var frm2 = new StringMatchingFilterDialog(new StringMatching(StringMatchingMode.Exact, m_log.ExceptionString)))
             {
                 if (frm2.ShowDialog() == DialogResult.OK)
                 {
                     var filter = new LogMessageFilter();
                     filter.RelatedType = new StringMatching(StringMatchingMode.Exact, frm.SelectedItem);
                     filter.ExceptionText = frm2.ResultFilter;
                     return filter;
                 }
                 return null;
             }
         }
         return null;
     }
 }