public LogSource(ILogSourcesManagerInternal owner, int id, ILogProviderFactory providerFactory, IConnectionParams connectionParams, IModelThreads threads, ITempFilesManager tempFilesManager, Persistence.IStorageManager storageManager, IInvokeSynchronization invoker, Settings.IGlobalSettingsAccessor globalSettingsAccess, IBookmarks bookmarks) { this.owner = owner; this.tracer = new LJTraceSource("LogSource", string.Format("ls{0:D2}", id)); this.tempFilesManager = tempFilesManager; this.invoker = invoker; this.globalSettingsAccess = globalSettingsAccess; this.bookmarks = bookmarks; try { this.logSourceThreads = new LogSourceThreads(this.tracer, threads, this); this.timeGaps = new TimeGapsDetector(tracer, invoker, new LogSourceGapsSource(this)); 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.Container.Add(this); this.owner.FireOnLogSourceAdded(this); this.LoadBookmarks(); }
public MediaBasedReaderParams(ILogSourceThreads threads, ILogMedia media, ITempFilesManager tempFilesManager, MessagesReaderFlags flags = MessagesReaderFlags.None, Settings.IGlobalSettingsAccessor settingsAccessor = null) { Threads = threads; Media = media; Flags = flags; TempFilesManager = tempFilesManager; SettingsAccessor = settingsAccessor ?? Settings.DefaultSettingsAccessor.Instance; }
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.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, Type logReaderType, StreamBasedFormatInfo logFormatInfo, LJTraceSource traceSource, IRollingFilesMediaStrategy rollingStrategy, ITempFilesManager tempFilesManager) { 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 SearchingParser( IPositionedMessagesReader owner, CreateSearchingParserParams p, TextStreamPositioningParams textStreamPositioningParams, DejitteringParams?dejitteringParams, Stream rawStream, Encoding streamEncoding, bool allowPlainTextSearchOptimization, LoadedRegex headerRe, ILogSourceThreads threads, ITraceSourceFactory traceSourceFactory, RegularExpressions.IRegexFactory regexFactory ) { this.owner = owner; this.parserParams = p; this.plainTextSearchOptimizationAllowed = allowPlainTextSearchOptimization && ((p.Flags & MessagesParserFlag.DisablePlainTextSearchOptimization) == 0); this.threads = threads; this.requestedRange = p.Range; this.textStreamPositioningParams = textStreamPositioningParams; this.dejitteringParams = dejitteringParams; this.rawStream = rawStream; this.streamEncoding = streamEncoding; this.regexFactory = regexFactory; this.trace = traceSourceFactory.CreateTraceSource("LogSource", "srchp." + GetHashCode().ToString("x")); this.dummyFilter = new Filter(FilterAction.Include, "", true, new Search.Options(), null, regexFactory); var continuationToken = p.ContinuationToken as ContinuationToken; if (continuationToken != null) { this.requestedRange = new FileRange.Range(continuationToken.NextPosition, requestedRange.End); } this.aligmentTextAccess = new StreamTextAccess(rawStream, streamEncoding, textStreamPositioningParams); this.aligmentSplitter = new MessagesSplitter(aligmentTextAccess, headerRe.Clone().Regex, headerRe.GetHeaderReSplitterFlags()); this.aligmentCapture = new TextMessageCapture(); this.progressAndCancellation = new ProgressAndCancellation() { progressHandler = p.ProgressHandler, cancellationToken = p.Cancellation, continuationToken = new ContinuationToken() { NextPosition = requestedRange.Begin } }; this.impl = Enum(); }
public Presenter( IView view, ITempFilesManager tempFilesManager, LogViewer.IPresenterFactory logViewerPresenterFactory ) { this.view = view; this.view.SetEventsHandler(this); this.tempFilesManager = tempFilesManager; this.threads = new ModelThreads(); this.logSourceThreads = new LogSourceThreads( LJTraceSource.EmptyTracer, threads, null); this.model = new Presenters.LogViewer.DummyModel(threads); this.logPresenter = logViewerPresenterFactory.Create( model, view.LogViewer, createIsolatedPresenter: true); logPresenter.ShowTime = true; }
public MessagesReader(MediaBasedReaderParams readerParams, FormatInfo fmt) : base(readerParams.Media, null, null, fmt.ExtensionsInitData, fmt.TextStreamPositioningParams, readerParams.Flags, readerParams.SettingsAccessor) { if (readerParams.Threads == null) { throw new ArgumentNullException(nameof(readerParams) + ".Threads"); } this.threads = readerParams.Threads; this.fmtInfo = fmt; this.tempFilesManager = readerParams.TempFilesManager; base.Extensions.AttachExtensions(); this.isBodySingleFieldExpression = new Lazy <bool>(() => { return(CreateNewFieldsProcessor().IsBodySingleFieldExpression()); }); }
public MessagesReader(MediaBasedReaderParams readerParams, FormatInfo fmt) : base(readerParams.Media, null, null, fmt.ExtensionsInitData, fmt.TextStreamPositioningParams, readerParams.Flags, readerParams.SettingsAccessor) { if (readerParams.Threads == null) { throw new ArgumentNullException(nameof(readerParams) + ".Threads"); } this.threads = readerParams.Threads; this.fmtInfo = fmt; this.tempFilesManager = readerParams.TempFilesManager; this.trace = new LJTraceSource("LogSource", string.Format("{0}.r{1:x4}", readerParams.ParentLoggingPrefix, Hashing.GetShortHashCode(this.GetHashCode()))); base.Extensions.AttachExtensions(); this.isBodySingleFieldExpression = new Lazy <bool>(() => { return(CreateNewFieldsProcessor().IsBodySingleFieldExpression()); }); }
/// <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, ILogSourceThreads 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 Content( 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 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; }
public MessagesBuilderCallback(ILogSourceThreads threads, IThread fakeThread) { this.threads = threads; this.fakeThread = fakeThread; }