/// <summary> /// Creates <see cref="ILogFilter"/> from the given <see cref="IConfigurationSection"/>. The /// <paramref name="defaultFilter"/> is returned if no filter was configured. /// </summary> public static ILogFilter Create(IConfigurationSection configuration, ILogFilter defaultFilter) { // simple string? var filterStr = configuration.Value; if (filterStr != null) { // not yet supported return(defaultFilter); } if (configuration.Exists()) { if (configuration.GetChildren().Count() > 1) { return(new OrFilter(configuration.GetChildren().Select(x => Create(x, defaultFilter)))); } else { var logger = configuration.GetValue <string>("Logger"); var level = configuration.GetValue <string>("Level"); return(new SimpleLogFilter( level.SomeNotNull().Map(x => (LogLevel)Enum.Parse(typeof(LogLevel), x)), logger.SomeNotNull())); } } return(defaultFilter); }
/// <summary> /// Initializes a new instance of the <see cref="Logger"/> class. /// </summary> public Logger(ILogFilter logFilter) { if (logFilter != null) { AddLogFilter(logFilter); } }
/// <summary> /// Creates new instance. /// </summary> /// <param name="formatter">Log entry formatter.</param> /// <param name="filter">Log entry filter.</param> protected TextLogSerializerBase(ILogFormatter formatter, ILogFilter filter) { Ensure.NotNull(formatter, "formatter"); Ensure.NotNull(filter, "filter"); Formatter = formatter; Filter = filter; }
/// <summary> /// build new parameters with specified filters and default values /// </summary> /// <param name="logFilter">log filter</param> public LogParameters(ILogFilter logFilter) { LogFilter = logFilter; LogFactory = Log.LogFactory; LogItemTextFormatter = LogFactory.CreateLogItemTextFormatter(); LogItemBuffer = LogFactory.CreateLogItemBuffer(); }
public static LogFilterPipeline GetFilterPipeLine(LoggerFilterConfigurationElementCollection filterElements) { //rwlock.AcquireReaderLock(defaultLockTimeout); try { LogFilterPipeline pipeline = new LogFilterPipeline(); if (filterElements != null) { foreach (LoggerFilterConfigurationElement ele in filterElements) { ILogFilter filter = GetFilterFromConfig(ele); if (filter != null) { pipeline.Add(filter); } } } return(pipeline); } catch (Exception ex) { throw new LogException("创建FilterPipeline时发生错误:" + ex.Message, ex); } //finally //{ // rwlock.ReleaseReaderLock(); //} }
public LogAppender(Logger logger) { this.logger = logger; this.logFilter = new LogFilter(); this.logLayout = new LogLayout(); this.fileLog = new FileLog(); }
void ReportExceptionCheckingFilters(Exception exception, LogEntry log, ILogFilter logFilter) { try { NameValueCollection additionalInfo = new NameValueCollection(); additionalInfo.Add(ExceptionFormatter.Header, string.Format(Resources.Culture, Resources.FilterEvaluationFailed, logFilter.Name)); additionalInfo.Add(Resources.FilterEvaluationFailed2, string.Format(Resources.Culture, Resources.FilterEvaluationFailed3, log)); ExceptionFormatter formatter = new ExceptionFormatter(additionalInfo, Resources.DistributorEventLoggerDefaultApplicationName); LogEntry reportingLogEntry = new LogEntry(); reportingLogEntry.Severity = TraceEventType.Error; reportingLogEntry.Message = formatter.GetMessage(exception); reportingLogEntry.EventId = LogWriterFailureEventID; structureHolder.ErrorsTraceSource.TraceData(reportingLogEntry.Severity, reportingLogEntry.EventId, reportingLogEntry); } catch (Exception ex) { instrumentationProvider.FireFailureLoggingErrorEvent(Resources.FailureWhileCheckingFilters, ex); } }
/// <summary> /// This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code. /// Performs any action to handle an error during checking. /// </summary> /// <param name="ex">The exception raised during filter evaluation.</param> /// <param name="logEntry">The log entry being evaluated.</param> /// <param name="filter">The fiter that raised the exception.</param> /// <returns>True signaling processing should continue.</returns> public bool FilterCheckingFailed(Exception ex, LogEntry logEntry, ILogFilter filter) { ReportExceptionCheckingFilters(ex, logEntry, filter); return(true); }
protected override IReadOnlyList <LogEvent> GetLogs(LogTimePeriod logTimePeriod, ILogFilter filter, int skip, int take) { var logs = new List <LogEvent>(); var count = 0; // foreach full day in the range - see if we can find one or more filenames that end with // yyyyMMdd.json - Ends with due to MachineName in filenames - could be 1 or more due to load balancing for (DateTime day = logTimePeriod.StartTime.Date; day.Date <= logTimePeriod.EndTime.Date; day = day.AddDays(1)) { // Filename ending to search for (As could be multiple) var filesToFind = GetSearchPattern(day); var filesForCurrentDay = Directory.GetFiles(_logsPath, filesToFind); // Foreach file we find - open it foreach (var filePath in filesForCurrentDay) { // Open log file & add contents to the log collection // Which we then use LINQ to page over using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { using (var stream = new StreamReader(fs)) { var reader = new LogEventReader(stream); while (TryRead(reader, out LogEvent? evt)) { // We may get a null if log line is malformed if (evt == null) { continue; } if (count > skip + take) { break; } if (count < skip) { count++; continue; } if (filter.TakeLogEvent(evt)) { logs.Add(evt); } count++; } } } } } return(logs); }
protected virtual Rect DrawFilters(Rect r) { EditorGUI.BeginChangeCheck(); //r.height += 2F; // Layout overflows, this 2F fixes the error margin. r = this.groupFilters.OnGUI(r); if (this.groupFilters.filters.Count > 0) { bool compact = true; if (this.console.position.width - r.x < GroupFilters.MinFilterWidth) { compact = false; r.x = 0F; r.y += r.height; r.width = this.console.position.width; } else { r.width = this.console.position.width - r.x; } r.height = Constants.SingleLineHeight; ILogFilter selectedFilter = this.groupFilters.SelectedFilter; if (selectedFilter != null) { selectedFilter.OnGUI(r, compact); r.y += r.height + 2F; } //for (int i = 0; i < this.groupFilters.filters.Count; i++) //{ // r = this.groupFilters.filters[i].OnGUI(r, compact); // r.x = 0F; // r.width = this.console.position.width; // r.height = Constants.SingleLineHeight; //} } else { r.y += r.height + 2F; } if (EditorGUI.EndChangeCheck() == true) { this.RefreshFilteredRows(); if (this.FilterAltered != null) { this.FilterAltered(); } } return(r); }
public void AddFilter(string key, ILogFilter filter) { if (_filters.ContainsKey(key)) { return; } _filters.Add(key, filter); }
/// <summary> /// Initializes a new instance of the <see cref="ConsoleAndTextLogger"/> class. /// </summary> /// <param name="loggingType">Type being logged.</param> /// <param name="filter">Log filter.</param> public ConsoleAndTextLogger(Type loggingType, ILogFilter filter) { _filter = filter; LoggingType = loggingType; if (m_StreamWriter == null) { m_StreamWriter = StreamWriter.Synchronized(new StreamWriter("HttpServer.log", true, Encoding.UTF8)); } }
private void TestParameterTypes <T>(float a, int b, bool c, byte d, short f, double g, decimal h, Enum i, ILogFilter j, Vector3?j2, Rect l, Rect?m, out int n, ref int o, out int?p, ref int?q, T r, out T t, ILogFilter v = null, int w = 13, string x = "Jojo") where T : class { n = 0; p = 0; t = default(T); Debug.Log("Test parameter types."); }
public Log(IEnumerable <ILogger> loggers, ISectionOrderer sectionOrderer, ILogFilter filter, string logLevel) { this._loggers = loggers; this._sectionOrderer = sectionOrderer; this._filter = filter; this._sections = new Dictionary <string, string>(); this.LogCreatedAtUtc = DateTime.UtcNow; this.LogLevel = logLevel; }
public void CanCreateLogEnabledFilterFromConfiguration() { LogEnabledFilterData filterData = new LogEnabledFilterData(true); MockLogObjectsHelper helper = new MockLogObjectsHelper(); ILogFilter filter = LogFilterCustomFactory.Instance.Create(context, filterData, helper.configurationSource, reflectionCache); ; Assert.IsNotNull(filter); Assert.AreEqual(filter.GetType(), typeof(LogEnabledFilter)); Assert.AreEqual(true, ((LogEnabledFilter)filter).Enabled); }
public void PriorityFilterMaximumPriotDefaultsToMaxIntWhenNotSpecified() { PriorityFilterData filterData = new PriorityFilterData(1000); MockLogObjectsHelper helper = new MockLogObjectsHelper(); ILogFilter filter = LogFilterCustomFactory.Instance.Create(context, filterData, helper.configurationSource, reflectionCache); ; Assert.IsNotNull(filter); Assert.AreEqual(filter.GetType(), typeof(PriorityFilter)); Assert.AreEqual(int.MaxValue, ((PriorityFilter)filter).MaximumPriority); }
public void CanCreatePriorityFilterFromConfiguration() { PriorityFilterData filterData = new PriorityFilterData(1000); MockLogObjectsHelper helper = new MockLogObjectsHelper(); ILogFilter filter = LogFilterCustomFactory.Instance.Create(context, filterData, helper.configurationSource, reflectionCache); ; Assert.IsNotNull(filter); Assert.AreEqual(filter.GetType(), typeof(PriorityFilter)); Assert.AreEqual(1000, ((PriorityFilter)filter).MinimumPriority); }
private void AddFilter(object data) { ILogFilter filter = Activator.CreateInstance(GroupFilters.logFilterTypes[(int)data]) as ILogFilter; this.filters.Add(filter); filter.ToggleEnable += this.OnFilterAltered; filter.Enabled = true; this.OnFilterAltered(); }
public Boolean Apply(LogEntry log, ILogFilter logFilter) { Double logValue = log.Severity.Value; if (logValue >= TriggerLevel && TargetLevel < CurrentLevel) { CurrentLevel = TargetLevel; logFilter.FilterRulesChanged(); } return(logValue >= CurrentLevel); }
/// <summary> /// build new parameters /// </summary> /// <param name="logFactory">log components factory</param> /// <param name="logFilter">log filters</param> /// <param name="logItemTextFormatter">log item text formatter</param> /// <param name="logItemBuffer">log item buffer</param> /// <param name="isRecordingEnabled">recording enabled or not (default false)</param> public LogParameters( ILogFactory logFactory, ILogFilter logFilter, ILogItemTextFormatter logItemTextFormatter, ILogItemBuffer logItemBuffer, bool isRecordingEnabled = false) : this(logFactory) { LogFilter = logFilter; LogItemTextFormatter = logItemTextFormatter; LogItemBuffer = logItemBuffer; IsRecordingEnabled = isRecordingEnabled; }
/// <summary> /// Initializes a new instance of the <see cref="T:Duplicati.Library.Logging.LogWrapper"/> class. /// </summary> /// <param name="self">The log instance to wrap.</param> /// <param name="filter">The log filter to use</param> public LogScope(ILogDestination self, ILogFilter filter, LogScope parent) { Parent = parent; m_log = self; m_filter = filter; if (parent != null) { Logging.Log.StartScope(this); } }
/// <summary> /// Initializes a new instance of the <see cref="Logger"/> class. /// </summary> public Logger(ILogFilter logFilter) { if (logFilter != null) { AddLogFilter(logFilter); } if (m_formatter != null) { m_formatter.UtcOffset = m_timestampProvider.UtcOffset; } }
public void Initialize() { ILogFilter logFilter = DefaultLogFilter.Warning; #if DEBUG logFilter = PrefixLogFilter.Ignored(new[] { "Root.Json", "Root.CompositeListFormatter", "Root.ApiClient", "Root.ApiAuthenticationState" }); #endif logFactory = new DefaultLogFactory("Root") .AddSerializer(new ConsoleSerializer(new SingleLineLogFormatter(), logFilter)); Json json = new Json(); Domain(json); //priceCalculator = new PriceCalculator(eventDispatcher.Handlers); FormatterContainer formatters = new FormatterContainer(commandFormatter, eventFormatter, queryFormatter, exceptionFormatter); eventDispatcher = new BrowserEventDispatcher(formatters, logFactory, json); BrowserExceptionHandler exceptionHandler = new BrowserExceptionHandler(formatters, logFactory, json); services //.AddSingleton(priceCalculator) .AddSingleton(json) .AddSingleton(formatters) .AddSingleton(logFactory) .AddTransient <CurrencyFormatterFactory>() .AddSingleton <MessageBuilder>() .AddScoped <LocalExpenseOnlineRunner>() .AddTransient <HttpCommandDispatcher>() .AddTransient <CommandStorage>() .AddTransient <CreateExpenseStorage>() .AddTransient <OfflineCommandDispatcher>() .AddSingleton <LocalCommandDispatcher>() .AddSingleton <MenuItemService>() .AddSingleton <ICommandHandlerCollection, LocalCommandHandlerCollection>() .AddTransient <ICommandDispatcher, LocalCommandDispatcher>() .AddTransient <IQueryDispatcher, HttpQueryDispatcher>() .AddTransient(typeof(ILog <>), typeof(DefaultLog <>)) .AddSingleton(eventDispatcher) .AddSingleton(eventDispatcher.Handlers) .AddSingleton(eventDispatcher.Dispatcher) .AddSingleton(exceptionHandler) .AddSingleton(exceptionHandler.Handler) .AddSingleton(exceptionHandler.HandlerBuilder); void AddMiddleware <T>(IServiceCollection services, bool register = true) where T : class, HttpQueryDispatcher.IMiddleware
private void Logging() { ILogFilter logFilter = DefaultLogFilter.Debug; #if !DEBUG logFilter = DefaultLogFilter.Warning; #endif logFactory = new DefaultLogFactory("Root") .AddSerializer(new ConsoleSerializer(new DefaultLogFormatter(), logFilter)); errorLog = logFactory.Scope("Error"); }
public void PriorityFilterMaximumPriotDefaultsToMaxIntWhenNotSpecified() { PriorityFilterData filterData = new PriorityFilterData(1000); MockLogObjectsHelper helper = new MockLogObjectsHelper(); helper.loggingSettings.LogFilters.Add(filterData); ILogFilter filter = GetFilter(filterData.Name, helper.configurationSource); Assert.IsNotNull(filter); Assert.AreEqual(filter.GetType(), typeof(PriorityFilter)); Assert.AreEqual(int.MaxValue, ((PriorityFilter)filter).MaximumPriority); }
public void CanCreateCategoryFilterFromEmptyCategoryConfiguration() { NamedElementCollection <CategoryFilterEntry> categoryEntries = new NamedElementCollection <CategoryFilterEntry>(); CategoryFilterData filterData = new CategoryFilterData("category", categoryEntries, CategoryFilterMode.DenyAllExceptAllowed); MockLogObjectsHelper helper = new MockLogObjectsHelper(); ILogFilter filter = LogFilterCustomFactory.Instance.Create(context, filterData, helper.configurationSource, reflectionCache); ; Assert.IsNotNull(filter); Assert.AreEqual(filter.GetType(), typeof(CategoryFilter)); Assert.AreEqual(0, ((CategoryFilter)filter).CategoryFilters.Count); Assert.AreEqual(CategoryFilterMode.DenyAllExceptAllowed, ((CategoryFilter)filter).CategoryFilterMode); }
public void CanCreateLogEnabledFilterFromConfiguration() { LogEnabledFilterData filterData = new LogEnabledFilterData(true); MockLogObjectsHelper helper = new MockLogObjectsHelper(); helper.loggingSettings.LogFilters.Add(filterData); ILogFilter filter = GetFilter(filterData.Name, helper.configurationSource); Assert.IsNotNull(filter); Assert.AreEqual(filter.GetType(), typeof(LogEnabledFilter)); Assert.AreEqual(true, ((LogEnabledFilter)filter).Enabled); }
public void CanCreatePriorityFilterFromConfiguration() { PriorityFilterData filterData = new PriorityFilterData(1000); MockLogObjectsHelper helper = new MockLogObjectsHelper(); helper.loggingSettings.LogFilters.Add(filterData); ILogFilter filter = GetFilter(filterData.Name, helper.configurationSource); Assert.IsNotNull(filter); Assert.AreEqual(filter.GetType(), typeof(PriorityFilter)); Assert.AreEqual(1000, ((PriorityFilter)filter).MinimumPriority); }
public void PriorityFilterShouldNotLogWhenPriotityIsAboveMaxPriority() { PriorityFilterData filterData = new PriorityFilterData(0); filterData.MaximumPriority = 100; MockLogObjectsHelper helper = new MockLogObjectsHelper(); ILogFilter filter = LogFilterCustomFactory.Instance.Create(context, filterData, helper.configurationSource, reflectionCache); ; Assert.IsNotNull(filter); Assert.AreEqual(filter.GetType(), typeof(PriorityFilter)); Assert.IsTrue(((PriorityFilter)filter).ShouldLog(100)); Assert.IsFalse(((PriorityFilter)filter).ShouldLog(101)); }
public void CanBuildCustomLogFilterFromGivenConfiguration() { CustomLogFilterData filterData = new CustomLogFilterData("custom", typeof(MockCustomLogFilter)); filterData.SetAttributeValue(MockCustomProviderBase.AttributeKey, "value1"); MockLogObjectsHelper helper = new MockLogObjectsHelper(); ILogFilter filter = LogFilterCustomFactory.Instance.Create(new MockBuilderContext(), filterData, helper.configurationSource, new ConfigurationReflectionCache()); Assert.IsNotNull(filter); Assert.AreSame(typeof(MockCustomLogFilter), filter.GetType()); Assert.AreEqual("value1", ((MockCustomLogFilter)filter).customValue); }
/// <summary> /// Finds the log filter in a collection. /// </summary> /// <param name="typeName">Name of the type.</param> /// <param name="availableFilters">The available filters.</param> /// <returns></returns> private ILogFilter FindLogFilter(string typeName, ICollection availableFilters) { ILogFilter ret = null; foreach (ILogFilter filter in availableFilters) { if (filter.GetType().FullName == typeName) { ret = filter; break; } } return(ret); }
private static TestEntLibLoggerFactoryAdapter CreateTestEntLibLoggerFactoryAdapter(ILogFilter filter) { LogWriter logWriter = new LogWriterImpl( new ILogFilter[] { filter } , new LogSource[] { new LogSource("logSource") } , new LogSource("defaultLogSource") , new LogSource("notProcessedLogSource") , new LogSource("errorsLogSource") , "DefaultCategory" , true , true ); return new TestEntLibLoggerFactoryAdapter(5, EntLibLoggerSettings.DEFAULTEXCEPTIONFORMAT, logWriter); }
/// <summary> /// Initializes a new instance of the <see cref="ConsoleLogger"/> class. /// </summary> /// <param name="loggingType">Type being logged.</param> /// <param name="filter">Log filter.</param> public ConsoleLogger(Type loggingType, ILogFilter filter) { _filter = filter; LoggingType = loggingType; }
/// <summary> /// Initializes a new instance of the <see cref="ConsoleLogFactory"/> class. /// </summary> /// <param name="filter">The filter.</param> public ConsoleLogFactory(ILogFilter filter) { _filter = filter; }
/// <summary> /// Removes the filter. /// </summary> /// <param name="filter">The filter.</param> /// <returns><code>true</code> if filter is removed, <code>false</code> if not active already.</returns> public bool RemoveFilter(ILogFilter filter) { if (filter == null) return false; lock (m_filters.SyncRoot) { if (!m_filters.Contains(filter)) return false; // Deactivate filter before it is removed from filter manager to allow it to unregister its event handlers # warning Removed becouse it loopback // filter.IsFilterActive = false; m_filters.Remove(filter); RaiseFilterRemovedEvent(filter); return true; } }
/// <summary> /// Removes the log filter. /// </summary> /// <param name="filter">The filter.</param> public override void RemoveLogFilter(ILogFilter filter) { }
/// <summary> /// Creates a filter to apply the the Logger from the corresponding section in Loggers.config. /// </summary> /// <param name="name"><c>String</c> that specifies the name of the <c>Logger</c> to lookup.</param> /// <returns><c>ILogFilter</c> set for Logger from config file.</returns> private static ILogFilter FillFilter( XmlConfiguration config) { ILogFilter filter = null; NameValueCollection filterColl = null; string filterClass = null; config = config.GetConfig("logger", "filter"); // Create the Filter object try { filterColl = config.GetAttributes("filter"); filterClass = filterColl["class"]; filter = (ILogFilter) Activator.CreateInstance(Type.GetType(filterClass)); } catch (Exception e) { // System.MissingMethodException } return filter; }
/// <summary> /// Adds the filter. /// </summary> /// <param name="filter">The filter.</param> /// <returns><code>true</code> if filter is added, <code>false</code> if already active.</returns> public bool AddFilter(ILogFilter filter) { if (filter == null) return false; lock (m_filters.SyncRoot) { if (m_filters.Contains(filter)) return false; m_filters.Add(filter); RaiseFilterAddedEvent(filter); return true; } }
/// <summary> /// Changes the state of the filter menu checked. /// </summary> /// <param name="filter">The filter.</param> /// <param name="newState">if set to <c>true</c> menu item is checked.</param> private void ChangeFilterMenuCheckedState(ILogFilter filter, bool newState) { // Get index of filter int index = m_logFilters.IndexOf(filter); if (index >= m_logFilters.Count || index < 0) return; // Get menu item, make it checked MenuItem menu = (MenuItem) m_filterMenuItemsByPriority.GetByIndex(index); if (null != menu) { menu.Checked = newState; } }
/// <summary> /// Called when filter is added to filter manager. /// </summary> /// <param name="filter">The filter.</param> private void OnFilterAdded(ILogFilter filter) { ChangeFilterMenuCheckedState(filter, true); }
/// <summary> /// Removes the log filter. /// </summary> /// <param name="filter">The filter.</param> public virtual void RemoveLogFilter(ILogFilter filter) { Filters.Remove(filter); }
/// <summary> /// Adds the log filter. /// </summary> /// <param name="filter">The filter.</param> public virtual void AddLogFilter(ILogFilter filter) { Filters.Add(filter); }
public EventLogFilterModule(ILogFilterRepo eventLogFilterRepo) : base("/EventLogFilter") { #region Browser routing Get["/"] = _ => { var owinEnvironment = (IDictionary<string, object>)this.Context.Items["OWIN_REQUEST_ENVIRONMENT"]; var owinCtx = new OwinContext(owinEnvironment); //Model.Title = "We have Issues Again with IOC socks..."; return View["views/Home/index", Model]; }; Get["/"] = _ => { DateTime tTime = DateTime.Now; DateTime fTime = tTime.AddHours(Global_Const.LASTHOURS_DEFAULT); Model = eventLogFilterRepo.GetData(fromTime: fTime, toTime: tTime); return View["EventLogFilter", Model]; }; Get["/lasthours/{value:int}"] = _ => { DateTime tTime = DateTime.Now; //DateTime.Parse("2014-01-06 21:45:00"); DateTime tCDateTime = new DateTime(tTime.Year, tTime.Month, tTime.Day, tTime.Hour, tTime.Minute - tTime.Minute % 5, 0); int lasthours = -1 * _.value; DateTime fTime = tCDateTime.AddHours(lasthours); Model = eventLogFilterRepo.GetData(fromTime: fTime, toTime: tCDateTime); Model.LastRefreshedTime = tCDateTime; return View["EventLogFilter", Model]; }; Get["/between/{fromdate:datetime}/{todate:datetime}"] = _ => { DateTime tTime = _.todate; DateTime fTime = _.fromdate; Model = eventLogFilterRepo.GetData(fromTime: fTime, toTime: tTime); return View["EventLogFilter", Model]; }; #endregion #region Rest api calls // the datatables.net jQuery grid wants the data as a two dimensional json array called aaData // to get best performance for lazy rendering // see http://datatables.net/release-datatables/examples/ajax/defer_render.html // So we need to convert the LogFilterRow to a jagged string[][] array to get right format // see: http://msdn.microsoft.com/en-us/library/aa288453(v=vs.71).aspx Get["/api/datatables/"] = _ => { DateTime tTime = DateTime.Now; DateTime fTime = tTime.AddHours(Global_Const.LASTHOURS_DEFAULT); Model = eventLogFilterRepo.GetData(fromTime: fTime, toTime: tTime); var aaTableAjax = new HomeModule.DataTableAjax(); int i = 0; string[][] aaData = new string[Model.LogRows.Count()][]; foreach (var lRow in Model.LogRows) { var aDataTblRow = new string[4]; aDataTblRow[0] = lRow.TimeAsStr; aDataTblRow[1] = lRow.LogType; aDataTblRow[2] = lRow.Src; aDataTblRow[3] = lRow.Msg; aaData[i] = aDataTblRow; i++; } aaTableAjax.aaData = aaData; return aaTableAjax; }; #endregion }
/// <summary> /// Adds the log filter. /// </summary> /// <param name="filter">The filter.</param> public override void AddLogFilter(ILogFilter filter) { }
/// <summary> /// Raises the filter removed event. /// </summary> /// <param name="filter">The filter.</param> private void RaiseFilterRemovedEvent(ILogFilter filter) { FilterAction e = FilterRemovedEvent; if (e != null) e(filter); }
/// <summary> /// Called when filter is removed from filter manager. /// </summary> /// <param name="filter">The filter.</param> private void OnFilterRemoved(ILogFilter filter) { ChangeFilterMenuCheckedState(filter, false); }
public bool FilterCheckingFailed(System.Exception ex, LogEntry logEntry, ILogFilter filter) { failingFilters.Add(filter); return returnValue; }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// // APIREV: make own type like TraceEventType so user won't have a need to add a reference to Logger dll. // Create log instance public static void Initialize(string logFilePath, int logFileSize, TraceEventType minimalSeverity, bool isLogEnabled) { if (logFileSize < 1) throw new SettingsException(Properties.Resources.LogFileCantBeSmall); _minimalSeverity = minimalSeverity; _isLogEnabled = isLogEnabled; // Create message formatter TextFormatter formatter = new TextFormatter(MESSAGE_FORMAT); // Create Log sources LogSource emptyTraceSource = new LogSource("EmptySource"); LogSource errorsTraceSource = new LogSource("Logger", SourceLevels.All); // Create listener for rolling log file RollingFlatFileTraceListener rollingTrace = new RollingFlatFileTraceListener(logFilePath, "", "", formatter, logFileSize, "yyyy - MM - dd", RollFileExistsBehavior.Overwrite, RollInterval.Year); errorsTraceSource.Listeners.Add(rollingTrace); // Create and fill sources array IDictionary<string, LogSource> traceSources = new Dictionary<string, LogSource>(); traceSources.Add(TraceEventType.Critical.ToString(), errorsTraceSource); traceSources.Add(TraceEventType.Error.ToString(), errorsTraceSource); traceSources.Add(TraceEventType.Warning.ToString(), errorsTraceSource); traceSources.Add(TraceEventType.Information.ToString(), errorsTraceSource); // create default category string string defaultCategory = _minimalSeverity.ToString(); ICollection<ILogFilter> filters = new ILogFilter[0]; _logWriter = new LogWriter(filters, // filters collection traceSources, // sources array emptyTraceSource, // all events trace source emptyTraceSource, // not processed trace source errorsTraceSource, // errors trace source defaultCategory, // string defaultCategory false, // enable tracing true); // save message as warning, when no categories match }
public MockEventLogFilterRepo(ILogFilter modelFilter) { LogFilter = modelFilter; }