public MessagesReader( MediaBasedReaderParams readerParams, FormatInfo fmt, FieldsProcessor.IFactory fieldsProcessorFactory, IRegexFactory regexFactory, ITraceSourceFactory traceSourceFactory ) : base(readerParams.Media, fmt.BeginFinder, fmt.EndFinder, fmt.ExtensionsInitData, fmt.TextStreamPositioningParams, readerParams.Flags, readerParams.SettingsAccessor) { if (readerParams.Threads == null) { throw new ArgumentNullException(nameof(readerParams) + ".Threads"); } this.threads = readerParams.Threads; this.traceSourceFactory = traceSourceFactory; this.regexFactory = regexFactory; this.fmtInfo = fmt; this.fieldsProcessorFactory = fieldsProcessorFactory; this.trace = traceSourceFactory.CreateTraceSource("LogSource", string.Format("{0}.r{1:x4}", readerParams.ParentLoggingPrefix, Hashing.GetShortHashCode(this.GetHashCode()))); base.Extensions.AttachExtensions(); this.isBodySingleFieldExpression = new Lazy <bool>(() => { return(CreateNewFieldsProcessor().IsBodySingleFieldExpression()); }); }
public MessagesReader(MediaBasedReaderParams readerParams, JsonFormatInfo fmt) : base(readerParams.Media, fmt.BeginFinder, fmt.EndFinder, fmt.ExtensionsInitData, fmt.TextStreamPositioningParams, readerParams.Flags, readerParams.SettingsAccessor) { this.formatInfo = fmt; this.threads = readerParams.Threads; this.traceSourceFactory = readerParams.TraceSourceFactory; }
public Presenter( IView view, ITempFilesManager tempFilesManager, ITraceSourceFactory traceSourceFactory, RegularExpressions.IRegexFactory regexFactory, LogViewer.IPresenterFactory logViewerPresenterFactory, ISynchronizationContext synchronizationContext, LogMedia.IFileSystem fileSystem ) { this.view = view; this.view.SetEventsHandler(this); this.tempFilesManager = tempFilesManager; this.traceSourceFactory = traceSourceFactory; this.regexFactory = regexFactory; this.synchronizationContext = synchronizationContext; this.fileSystem = fileSystem; this.threads = new ModelThreads(); this.logSourceThreads = new LogSourceThreads( LJTraceSource.EmptyTracer, threads, null); this.model = new Presenters.LogViewer.DummyModel(); this.logPresenter = logViewerPresenterFactory.CreateIsolatedPresenter(model, view.LogViewer); logPresenter.ShowTime = true; logPresenter.EmptyViewMessageAllowed = false; }
public MediaBasedReaderParams(ILogSourceThreadsInternal threads, ILogMedia media, MessagesReaderFlags flags = MessagesReaderFlags.None, Settings.IGlobalSettingsAccessor settingsAccessor = null, string parentLoggingPrefix = null) { Threads = threads; Media = media; Flags = flags; SettingsAccessor = settingsAccessor ?? Settings.DefaultSettingsAccessor.Instance; ParentLoggingPrefix = parentLoggingPrefix; }
public MediaBasedReaderParams(ILogSourceThreadsInternal threads, ILogMedia media, ITempFilesManager tempFilesManager, ITraceSourceFactory traceSourceFactory, MessagesReaderFlags flags = MessagesReaderFlags.None, Settings.IGlobalSettingsAccessor settingsAccessor = null, string parentLoggingPrefix = null) { Threads = threads; Media = media; Flags = flags; TempFilesManager = tempFilesManager; TraceSourceFactory = traceSourceFactory; SettingsAccessor = settingsAccessor ?? Settings.DefaultSettingsAccessor.Instance; ParentLoggingPrefix = parentLoggingPrefix; }
public RollingFilesMedia( LogMedia.IFileSystem fileSystem, Type logReaderType, StreamBasedFormatInfo logFormatInfo, LJTraceSource traceSource, IRollingFilesMediaStrategy rollingStrategy, ITempFilesManager tempFilesManager, ITraceSourceFactory traceSourceFactory) { this.traceSourceFactory = traceSourceFactory; trace = traceSource; using (trace.NewFrame) { if (fileSystem == null) { throw new ArgumentNullException("fileSystem"); } this.rollingStrategy = rollingStrategy; this.logReaderType = logReaderType; this.logFormatInfo = logFormatInfo; this.tempFilesManager = tempFilesManager; try { this.fileSystem = fileSystem; this.baseDirectory = rollingStrategy.BaseDirectory; trace.Info("Base file directory: {0}", baseDirectory); this.concatStream = new ConcatReadingStream(); this.tempThreads = new LogSourceThreads(LJTraceSource.EmptyTracer, new ModelThreads(), null); this.fsWatcher = fileSystem.CreateWatcher(); this.fsWatcher.Path = this.baseDirectory; this.fsWatcher.Created += new FileSystemEventHandler(fsWatcher_Created); this.fsWatcher.Renamed += new RenamedEventHandler(fsWatcher_Renamed); this.fsWatcher.EnableRaisingEvents = true; trace.Info("Watcher enabled"); this.folderNeedsRescan = 1; } catch { trace.Error("Initialization failed. Disposing."); Dispose(); throw; } } }
public MessagesReader(MediaBasedReaderParams readerParams, XmlFormatInfo fmt) : base(readerParams.Media, fmt.BeginFinder, fmt.EndFinder, fmt.ExtensionsInitData, fmt.TextStreamPositioningParams, readerParams.Flags, readerParams.SettingsAccessor) { this.formatInfo = fmt; this.threads = readerParams.Threads; this.traceSourceFactory = readerParams.TraceSourceFactory; this.transformArgs = new XsltArgumentList(); this.xslExt = new LogJointXSLExtension(); transformArgs.AddExtensionObject(Properties.LogJointNS, this.xslExt); foreach (MessagesReaderExtensions.ExtensionData extInfo in this.Extensions.Items) { transformArgs.AddExtensionObject(Properties.LogJointNS + extInfo.Name, extInfo.Instance()); } }
public RollingFilesMedia( LogMedia.IFileSystem fileSystem, Func <MediaBasedReaderParams, IPositionedMessagesReader> readerCreator, LJTraceSource traceSource, IRollingFilesMediaStrategy rollingStrategy) { trace = traceSource; using (trace.NewFrame) { if (fileSystem == null) { throw new ArgumentNullException(nameof(fileSystem)); } this.rollingStrategy = rollingStrategy; this.readerCreator = readerCreator; try { this.fileSystem = fileSystem; this.baseDirectory = rollingStrategy.BaseDirectory; trace.Info("Base file directory: {0}", baseDirectory); this.concatStream = new ConcatReadingStream(); this.tempThreads = new LogSourceThreads(LJTraceSource.EmptyTracer, new ModelThreads(), null); this.fsWatcher = fileSystem.CreateWatcher(); this.fsWatcher.Path = this.baseDirectory; this.fsWatcher.Created += new FileSystemEventHandler(fsWatcher_Created); this.fsWatcher.Renamed += new RenamedEventHandler(fsWatcher_Renamed); this.fsWatcher.EnableRaisingEvents = true; trace.Info("Watcher enabled"); this.folderNeedsRescan = 1; } catch { trace.Error("Initialization failed. Disposing."); Dispose(); throw; } } }
public Presenter( IView view, ITempFilesManager tempFilesManager, ITraceSourceFactory traceSourceFactory, LogViewer.IPresenterFactory logViewerPresenterFactory, ISynchronizationContext synchronizationContext ) { this.view = view; this.view.SetEventsHandler(this); this.tempFilesManager = tempFilesManager; this.traceSourceFactory = traceSourceFactory; this.synchronizationContext = synchronizationContext; this.threads = new ModelThreads(); this.logSourceThreads = new LogSourceThreads( LJTraceSource.EmptyTracer, threads, null); this.model = new Presenters.LogViewer.DummyModel(); this.logPresenter = logViewerPresenterFactory.CreateIsolatedPresenter(model, view.LogViewer); logPresenter.ShowTime = true; }
public LogSource(ILogSourcesManagerInternal owner, int id, ILogProviderFactory providerFactory, IConnectionParams connectionParams, IModelThreadsInternal threads, ITempFilesManager tempFilesManager, Persistence.IStorageManager storageManager, ISynchronizationContext modelSyncContext, Settings.IGlobalSettingsAccessor globalSettingsAccess, IBookmarks bookmarks, ITraceSourceFactory traceSourceFactory, RegularExpressions.IRegexFactory regexFactory, LogMedia.IFileSystem fileSystem) { this.owner = owner; this.tracer = traceSourceFactory.CreateTraceSource("LogSource", string.Format("ls{0:D2}", id)); this.tempFilesManager = tempFilesManager; this.modelSyncContext = modelSyncContext; this.globalSettingsAccess = globalSettingsAccess; this.bookmarks = bookmarks; this.traceSourceFactory = traceSourceFactory; this.regexFactory = regexFactory; this.fileSystem = fileSystem; try { this.logSourceThreads = new LogSourceThreads(this.tracer, threads, this); this.timeGaps = new TimeGapsDetector(tracer, modelSyncContext, new LogSourceGapsSource(this), traceSourceFactory); this.timeGaps.OnTimeGapsChanged += timeGaps_OnTimeGapsChanged; this.logSourceSpecificStorageEntry = CreateLogSourceSpecificStorageEntry(providerFactory, connectionParams, storageManager); var extendedConnectionParams = connectionParams.Clone(true); this.LoadPersistedSettings(extendedConnectionParams); this.provider = providerFactory.CreateFromConnectionParams(this, extendedConnectionParams); } catch (Exception e) { tracer.Error(e, "Failed to initialize log source"); ((ILogSource)this).Dispose(); throw; } this.owner.Add(this); this.owner.FireOnLogSourceAdded(this); this.LoadBookmarks(); }
/// <summary> /// Loads a range of messages from Logs Table. The range is specified by two partition keys. /// </summary> /// <param name="wadTable">Table to load messages from</param> /// <param name="threads">Threads container that will store loaded threads</param> /// <param name="beginPartitionKey">Begin of the range. Messages with PartitionKey GREATER THAN or EQUAL to <paramref name="beginPartitionKey"/> are included to the range</param> /// <param name="endPartitionKey">End of the range. Messages with PartitionKey LESS THAN <paramref name="endPartitionKey"/> are included to the range</param> /// <param name="entriesLimit">If specified limits the number of items to return</param> /// <returns>Sequence of messages sorted by EventTickCount</returns> public static IEnumerable <IMessage> LoadWADLogsTableMessagesRange( IAzureDiagnosticLogsTable wadTable, ILogSourceThreadsInternal threads, EntryPartition beginPartition, EntryPartition endPartition, int?entriesLimit) { foreach (var entryAndIndex in LoadEntriesRange(wadTable, beginPartition, endPartition, entriesLimit, CancellationToken.None)) { var entry = entryAndIndex.Entry as WADLogsTableEntry; if (entry == null) { continue; } yield return(new Message( new EntryPartition(entry.EventTickCount).MakeMessagePosition(entryAndIndex.IndexWithinPartition), new EntryPartition(entry.EventTickCount).MakeMessagePosition(entryAndIndex.IndexWithinPartition + 1), threads.GetThread(new StringSlice(string.Format("{0}-{1}", entry.Pid, entry.Tid))), new MessageTimestamp(new DateTime(entry.EventTickCount, DateTimeKind.Utc)), new StringSlice(entry.Message), SeverityFlag.Info )); } }
public MessagesBuilderCallback(ILogSourceThreadsInternal threads, IThread fakeThread) { this.threads = threads; this.fakeThread = fakeThread; }