public void AddLogInformation(string message, LogMessageFilter filter) { IterateLoggers((logger) => { logger.Information(filter.Filter(message)); }); }
private LogMessageFilter ExcludeAssembly() { var filter = new LogMessageFilter(); filter.Assembly = new StringMatching(StringMatchingMode.Exact, m_log.AssemblyName); return(filter); }
private LogMessageFilter ExcludeBeforeAndAfter() { var filter = new LogMessageFilter(); filter.TimeFilter = new TimestampMatching(TimestampMatchingMode.Outside, m_minTime.AddMinutes(-3), m_maxTime.AddMinutes(1)); 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; }
private LogMessageFilter ExcludeSelectedTimeRange() { var filter = new LogMessageFilter(); filter.TimeFilter = new TimestampMatching(TimestampMatchingMode.Inside, m_minTime, m_maxTime); return(filter); }
private LogMessageFilter ExcludeType() { var filter = new LogMessageFilter(); filter.Type = new StringMatching(StringMatchingMode.Exact, m_log.TypeName); 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 Event() { var filter = new LogMessageFilter(); filter.EventName = new StringMatching(StringMatchingMode.Exact, m_log.EventName); return(filter); }
private LogMessageFilter ExcludeTypeAndLevel() { var filter = new LogMessageFilter(); filter.Type = new StringMatching(StringMatchingMode.Exact, m_log.TypeName); filter.Level = new EnumMatchingFlags(EnumMatchingFlagsMode.Any, 1 << (int)m_log.Level, m_log.Level.ToString()); return(filter); }
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); } }
private LogMessageFilter Message() { using (var frm = new StackDetailsFilter(m_log)) { if (frm.ShowDialog() == DialogResult.OK) { var filter = new LogMessageFilter(); filter.StackDetails = frm.Matching; return(filter); } return(null); } }
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 StackDetailsFilter(m_log)) { if (frm.ShowDialog() == DialogResult.OK) { var filter = new LogMessageFilter(); filter.StackDetails = frm.Matching; filter.EventName = new StringMatching(StringMatchingMode.Exact, m_log.EventName); return(filter); } return(null); } }
private LogMessageFilter MessageAndAssembly() { using (var frm = new StringMatchingFilterDialog(new StringMatching(StringMatchingMode.Exact, m_log.Details))) { if (frm.ShowDialog() == DialogResult.OK) { var filter = new LogMessageFilter(); filter.DetailsText = frm.ResultFilter; filter.Assembly = new StringMatching(StringMatchingMode.Exact, m_log.AssemblyName); 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 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); } }
private void MakeMenu(DataGridViewCellMouseEventArgs e, List <Tuple <string, Func <LogMessageFilter> > > items) { ContextMenuStrip menu = new ContextMenuStrip(); foreach (Tuple <string, Func <LogMessageFilter> > item in items) { var subMenu = new ToolStripMenuItem(item.Item1); for (int x = 0; x <= 6; x++) { ToolStripButton button = new ToolStripButton(((FilterLevel)x).Name()); button.Tag = (FilterLevel)x; button.Click += (send1, e1) => { LogMessageFilter filter = item.Item2(); if (filter != null) { filter.FilterLevel = (FilterLevel)((ToolStripButton)send1).Tag; LstFilters.Items.Add(filter); m_filters.Add(filter); RefreshFilters(); } }; subMenu.DropDownItems.Add(button); } menu.Items.Add(subMenu); ((ToolStripDropDownMenu)subMenu.DropDown).ShowImageMargin = false; subMenu.DropDown.Width = 150; } menu.ShowImageMargin = false; menu.Width = 150; menu.Show(dgvResults, dgvResults.PointToClient(Cursor.Position)); }
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); }
public void AddLogInformation(string message, LogMessageFilter filter) { IterateLoggers((logger) => { logger.Information(filter.Filter(message)); }); }