public PostprocessorOutputRecord( ILogSourcePostprocessor metadata, LogSourceRecord logSourceRecord, Action scheduleRefresh, Action fireChangeNotification, LJTraceSource trace, IHeartBeatTimer heartbeat, ISynchronizationContext modelSyncContext, ISynchronizationContext threadPoolSyncContext, Telemetry.ITelemetryCollector telemetry, IOutputDataDeserializer outputDataDeserializer) { this.metadata = metadata; this.logSourceRecord = logSourceRecord; state = new LoadingState(new PostprocessorOutputRecordState.Context() { owner = this, scheduleRefresh = scheduleRefresh, fireChangeNotification = fireChangeNotification, tracer = trace, telemetry = telemetry, heartbeat = heartbeat, modelSyncContext = modelSyncContext, threadPoolSyncContext = threadPoolSyncContext, outputDataDeserializer = outputDataDeserializer }, null, null); }
public static void SetupLogging(LJTraceSource tracer, IShutdown shutdown) { void unhandledExceptionEventHandler(object sender, UnhandledExceptionEventArgs e) { string logMsg = "Unhandled domain exception occurred"; if (e.ExceptionObject is Exception ex) { tracer.Error((Exception)e.ExceptionObject, logMsg); } else { tracer.Error("{0}: ({1}) {2}", logMsg, e.ExceptionObject.GetType(), e.ExceptionObject); } } AppDomain.CurrentDomain.UnhandledException += unhandledExceptionEventHandler; void unobservedTaskExceptionEventHandler(object sender, UnobservedTaskExceptionEventArgs e) { tracer.Error(e.Exception, "UnobservedTaskException"); } TaskScheduler.UnobservedTaskException += unobservedTaskExceptionEventHandler; shutdown.Phase2Cleanup += (s, e) => { AppDomain.CurrentDomain.UnhandledException -= unhandledExceptionEventHandler; TaskScheduler.UnobservedTaskException -= unobservedTaskExceptionEventHandler; }; }
public FieldsProcessorImpl( InitializationParams initializationParams, IEnumerable <string> inputFieldNames, IEnumerable <ExtensionInfo> extensions, Persistence.IStorageEntry cacheEntry, LJTraceSource trace, Telemetry.ITelemetryCollector telemetryCollector, IMetadataReferencesProvider metadataReferencesProvider, IAssemblyLoader assemblyLoader ) { if (inputFieldNames == null) { throw new ArgumentNullException(nameof(inputFieldNames)); } initializationParams.InitializeInstance(this); if (extensions != null) { this.extensions.AddRange(extensions); } this.inputFieldNames = inputFieldNames.Select((name, idx) => name ?? string.Format("Field{0}", idx)).ToList(); this.cacheEntry = cacheEntry; this.trace = trace; this.telemetryCollector = telemetryCollector; this.metadataReferencesProvider = metadataReferencesProvider; this.assemblyLoader = assemblyLoader; }
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 Operation(LJTraceSource trace, string name) { this.trace = trace; this.name = name; this.id = GetHashCode().ToString("x8"); LogPoint("started", null); }
public PluginsManager( IApplication entryPoint, UI.Presenters.MainForm.IPresenter mainFormPresenter, Telemetry.ITelemetryCollector telemetry, IShutdown shutdown) { this.tracer = new LJTraceSource("Extensibility", "plugins-mgr"); this.entryPoint = entryPoint; this.mainFormPresenter = mainFormPresenter; InitPlugins(telemetry); RegisterInteropClasses(); LoadTabExtensions(); mainFormPresenter.TabChanging += (sender, e) => { var ext = e.CustomTabTag as IMainFormTabExtension; if (ext == null) { return; } try { ext.OnTabPageSelected(); } catch (Exception ex) { telemetry.ReportException(ex, "activation of plugin tab: " + ext.Caption); tracer.Error(ex, "Failed to activate extension tab"); } }; shutdown.Cleanup += (s, e) => Dispose(); }
public WorkspacesManager( ILogSourcesManager logSources, ILogProviderFactoryRegistry logProviderFactoryRegistry, IStorageManager storageManager, Backend.IBackendAccess backend, ITempFilesManager tempFilesManager, MRU.IRecentlyUsedEntities recentlyUsedEntities, IShutdown shutdown, ITraceSourceFactory traceSourceFactory ) { this.tracer = traceSourceFactory.CreateTraceSource("Workspaces", "ws"); this.logSources = logSources; this.backendAccess = backend; this.tempFilesManager = tempFilesManager; this.logProviderFactoryRegistry = logProviderFactoryRegistry; this.storageManager = storageManager; this.recentlyUsedEntities = recentlyUsedEntities; if (backend.IsConfigured) { this.status = WorkspacesManagerStatus.NoWorkspace; } else { this.status = WorkspacesManagerStatus.Unavailable; } shutdown.Cleanup += (s, e) => shutdown.AddCleanupTask( WaitUploadCompletion().WithTimeout(TimeSpan.FromSeconds(10))); }
public AzureWorkspacesBackend(ITraceSourceFactory traceSourceFactory, string configUri) { this.trace = traceSourceFactory.CreateTraceSource("Workspaces", "wsbackend"); if (Uri.IsWellFormedUriString(configUri, UriKind.Absolute)) { this.serviceUrl = new Uri(configUri); } }
public NavigationManager( LJTraceSource tracer, Telemetry.ITelemetryCollector telemetry ) { this.tracer = tracer; this.telemetry = telemetry; }
public NavigationManager( LJTraceSource tracer, Telemetry.ITelemetryCollector telemetry, IChangeNotification changeNotification ) { this.tracer = tracer; this.telemetry = telemetry; this.changeNotification = changeNotification; }
public AzureWorkspacesBackend() { this.trace = new LJTraceSource("Workspaces", "wsbackend"); var configUri = LogJoint.Properties.Settings.Default.WorkspacesUrl; if (Uri.IsWellFormedUriString(configUri, UriKind.Absolute)) { this.serviceUrl = new Uri(configUri); } }
public Presenter( ILogSourcesManager logSourcesManager, IChangeNotification changeNotification, IView view, Preprocessing.IManager sourcesPreprocessingManager, Preprocessing.IStepsFactory preprocessingStepsFactory, MRU.IRecentlyUsedEntities mru, QuickSearchTextBox.IPresenter searchBoxPresenter, IAlertPopup alerts, ITraceSourceFactory traceSourceFactory ) { this.view = view; this.changeNotification = changeNotification; this.logSourcesManager = logSourcesManager; this.sourcesPreprocessingManager = sourcesPreprocessingManager; this.preprocessingStepsFactory = preprocessingStepsFactory; this.mru = mru; this.searchBoxPresenter = searchBoxPresenter; this.trace = traceSourceFactory.CreateTraceSource("UI", "hist-dlg"); this.alerts = alerts; items = Selectors.Create(() => visible, () => acceptedFilter, MakeItems); actuallySelected = Selectors.Create(() => items().displayItems, () => selected, (items, selected) => items.SelectMany(i => i.Flatten()).Where(i => selected.Contains(i.key)).ToImmutableList()); openButtonEnabled = Selectors.Create(actuallySelected, selected => selected.Any(IsOpenable)); rootViewItem = Selectors.Create(() => items().displayItems, () => selected, () => expanded, MakeRootItem); searchBoxPresenter.OnSearchNow += (s, e) => { acceptedFilter = searchBoxPresenter.Text; FocusItemsListAndSelectFirstItem(); changeNotification.Post(); }; searchBoxPresenter.OnRealtimeSearch += (s, e) => { acceptedFilter = searchBoxPresenter.Text; changeNotification.Post(); }; searchBoxPresenter.OnCancelled += (s, e) => { if (acceptedFilter != "") { acceptedFilter = ""; searchBoxPresenter.Focus(null); } else { visible = false; } changeNotification.Post(); }; view.SetViewModel(this); }
public RollingStrategy(LJTraceSource trace, IConnectionParams connectionParams) { baseFileName = connectionParams[fileNameParam]; if (string.IsNullOrEmpty(baseFileName)) { throw new ArgumentException("Base file name is not specified in the connection params"); } baseFileNameFirstChar = GetFileNameFirstChar(baseFileName); baseDirectory = Path.GetDirectoryName(baseFileName); trace.Info("Base file name first character: {0}", baseFileNameFirstChar); }
PendingUpdate( string tempInstallationDir, IUpdateKey key, LJTraceSource trace, Process updaterProcess, string autoRestartFlagFileName ) { this.tempInstallationDir = tempInstallationDir; this.key = key; this.trace = trace; this.updaterProcess = updaterProcess; this.autoRestartFlagFileName = autoRestartFlagFileName; }
IFieldsProcessor IFactory.CreateProcessor( IInitializationParams initializationParams, IEnumerable <string> inputFieldNames, IEnumerable <ExtensionInfo> extensions, LJTraceSource trace) { return(new FieldsProcessorImpl( (InitializationParams)initializationParams, inputFieldNames, extensions, cacheEntry, trace, telemetryCollector )); }
internal ScreenBuffer( double viewSize, InitialBufferPosition initialBufferPosition, LJTraceSource trace = null, bool disableSingleLogPositioningOptimization = false ) { this.buffers = new Dictionary <IMessagesSource, SourceBuffer>(); this.entries = new List <ScreenBufferEntry>(); this.entriesReadonly = entries.AsReadOnly(); this.initialBufferPosition = initialBufferPosition; this.disableSingleLogPositioningOptimization = disableSingleLogPositioningOptimization; this.trace = trace ?? LJTraceSource.EmptyTracer; ((IScreenBuffer)this).SetViewSize(viewSize); }
public Presenter( IView view, IInvokeSynchronization uiInvokeSynchronization, Persistence.IWebContentCache cache, IShutdown shutdown ) { this.downloaderForm = view; this.uiInvokeSynchronization = uiInvokeSynchronization; this.tracer = new LJTraceSource("BrowserDownloader", "web.dl"); this.cache = cache; shutdown.Cleanup += Shutdown; downloaderForm.SetEventsHandler(this); }
public Presenter( IView view, ISynchronizationContext uiInvokeSynchronization, Persistence.IWebContentCache cache, IShutdown shutdown, ITraceSourceFactory traceSourceFactory ) { this.downloaderForm = view; this.uiInvokeSynchronization = uiInvokeSynchronization; this.tracer = traceSourceFactory.CreateTraceSource("BrowserDownloader", "web.dl"); this.cache = cache; shutdown.Cleanup += Shutdown; downloaderForm.SetViewModel(this); }
public AzureTelemetryUploader( ITraceSourceFactory traceSourceFactory, string telemetryUrl, string issuesUrl ) { this.trace = traceSourceFactory.CreateTraceSource("Telemetry"); this.telemetryUrl = telemetryUrl; if (!Uri.IsWellFormedUriString(this.telemetryUrl, UriKind.Absolute)) { this.telemetryUrl = null; } this.issuesUrl = issuesUrl; if (!Uri.IsWellFormedUriString(this.issuesUrl, UriKind.Absolute)) { this.issuesUrl = null; } }
public SelectionManager( IView view, IScreenBuffer screenBuffer, LJTraceSource tracer, IPresentationDataAccess presentationDataAccess, IClipboardAccess clipboard, IScreenBufferFactory screenBufferFactory, IBookmarksFactory bookmarksFactory ) { this.view = view; this.screenBuffer = screenBuffer; this.clipboard = clipboard; this.presentationDataAccess = presentationDataAccess; this.tracer = tracer; this.screenBufferFactory = screenBufferFactory; this.bookmarksFactory = bookmarksFactory; }
public static async Task PcapToPdmp( string pcapFile, string[] keyFiles, string outputFile, ITShark tshark, CancellationToken cancellation, Action <string> reportStatus, LJTraceSource trace ) { var tsharkArgs = new StringBuilder(); tsharkArgs.Append($"-r \"{pcapFile}\""); tsharkArgs.Append($" -T pdml -2"); var keyFile = keyFiles.FirstOrDefault(); // todo: support many files if (!string.IsNullOrEmpty(keyFile) && File.Exists(keyFile)) { tsharkArgs.Append($" -o \"ssl.desegment_ssl_records: TRUE\" -o \"ssl.desegment_ssl_application_data: TRUE\" -o \"ssl.keylog_file:{keyFile}\""); } using (var process = tshark.Start(tsharkArgs.ToString())) using (var cancellationSub = cancellation.Register(() => process.Kill())) using (var xmlReader = XmlReader.Create(process.StandardOutput)) using (var writer = new StreamWriter(outputFile, false, new UTF8Encoding(false))) { var packetsRead = 0; var processTask = process.GetExitCodeAsync(Timeout.InfiniteTimeSpan); using (var statusReportTimer = new Timer( _ => reportStatus($"converting to text: {packetsRead} packets"), null, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(1))) { await Task.WhenAll( processTask, Convert(xmlReader, writer, cancellation, val => packetsRead = val, trace) ); } if (processTask.Result != 0) { trace.Error("tshark failed: {0}", process.StandardError.ReadToEnd()); throw new Exception($"tshark failed with code {processTask.Result}"); } } }
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()); }); }
public Presenter( ILogSourcesManager logSourcesManager, IView view, Preprocessing.IManager sourcesPreprocessingManager, Preprocessing.IStepsFactory preprocessingStepsFactory, MRU.IRecentlyUsedEntities mru, QuickSearchTextBox.IPresenter searchBoxPresenter, IAlertPopup alerts, ITraceSourceFactory traceSourceFactory ) { this.view = view; this.logSourcesManager = logSourcesManager; this.sourcesPreprocessingManager = sourcesPreprocessingManager; this.preprocessingStepsFactory = preprocessingStepsFactory; this.mru = mru; this.searchBoxPresenter = searchBoxPresenter; this.trace = traceSourceFactory.CreateTraceSource("UI", "hist-dlg"); this.alerts = alerts; searchBoxPresenter.OnSearchNow += (s, e) => { UpdateItems(); FocusItemsListAndSelectFirstItem(); }; searchBoxPresenter.OnRealtimeSearch += (s, e) => UpdateItems(); searchBoxPresenter.OnCancelled += (s, e) => { if (itemsFiltered) { UpdateItems(); searchBoxPresenter.Focus(null); } else { view.Hide(); } }; view.SetEventsHandler(this); }
public PluginsManager( ITraceSourceFactory traceSourceFactory, Telemetry.ITelemetryCollector telemetry, IShutdown shutdown, IPluginFormatsManager pluginFormatsManager, AutoUpdate.IUpdateDownloader pluginsIndexDownloader, IPluginsIndexFactory pluginsIndexFactory, IChangeNotification changeNotification, AutoUpdate.IUpdateDownloader updateDownloader ) { this.tracer = traceSourceFactory.CreateTraceSource("Extensibility", "plug-ins-mgr"); this.telemetry = telemetry; this.pluginFormatsManager = pluginFormatsManager; this.pluginsIndexDownloader = pluginsIndexDownloader; this.pluginsIndexFactory = pluginsIndexFactory; this.changeNotification = changeNotification; this.updateDownloader = updateDownloader; shutdown.Cleanup += (s, e) => Dispose(); }
static void CopyCustomFormats( string managedAssmebliesLocation, string tmpManagedAssmebliesLocation, HashSet <string> execludedFormats, LJTraceSource trace ) { var srcFormatsDir = Path.Combine(managedAssmebliesLocation, DirectoryFormatsRepository.RelativeFormatsLocation); var destFormatsDir = Path.Combine(tmpManagedAssmebliesLocation, DirectoryFormatsRepository.RelativeFormatsLocation); var destFormats = EnumFormatsDefinitions(destFormatsDir).ToLookup(x => x.Key); foreach (var srcFmt in EnumFormatsDefinitions(srcFormatsDir).Where(x => !destFormats.Contains(x.Key))) { if (execludedFormats.Contains(Path.GetFileName(srcFmt.Value).ToLower())) { trace.Info("not copying format excluded format {0}", srcFmt.Key); continue; } trace.Info("copying user-defined format {0} to {1}", srcFmt.Key, destFormatsDir); File.Copy(srcFmt.Value, Path.Combine(destFormatsDir, Path.GetFileName(srcFmt.Value))); } }
static void FinalizeInstallation(string installationDir, LJTraceSource trace) { #if CRAP // The code changes permissions to allow any mac user update app. This approach does not work :( // keeping the chmod code until working solution is found. trace.Info("finalizing installation"); var appPath = Path.GetFullPath(Path.Combine(installationDir, appLocationRelativeToInstallationRoot)); var chmod = Process.Start("chmod", "g+w \"" + appPath + "\""); trace.Error("changing premission for '{0}'", appPath); if (chmod == null) { trace.Error("failed to start chmod"); } else if (!chmod.WaitForExit(5000)) { trace.Error("chmod did not quit"); } else if (chmod.ExitCode != 0) { trace.Error("chmod did not quit ok: {0}", chmod.ExitCode); } #endif }
public TelemetryCollector( Persistence.IStorageManager storage, ITelemetryUploader telemetryUploader, ISynchronizationContext synchronization, MultiInstance.IInstancesCounter instancesCounter, IShutdown shutdown, IMemBufferTraceAccess traceAccess, ITraceSourceFactory traceSourceFactory ) { this.trace = traceSourceFactory.CreateTraceSource("Telemetry"); this.telemetryUploader = telemetryUploader; this.synchronization = synchronization; this.traceAccess = traceAccess; this.telemetryStorageEntry = storage.GetEntry("telemetry"); this.sessionStartedMillis = Environment.TickCount; this.currentSessionId = telemetryUploader.IsTelemetryConfigured ? ("session" + Guid.NewGuid().ToString("n")) : null; this.transactionInvoker = new AsyncInvokeHelper(synchronization, () => DoSessionsRegistryTransaction(TransactionFlag.Default)); shutdown.Cleanup += (s, e) => shutdown.AddCleanupTask(DisposeAsync()); if (currentSessionId != null) { CreateCurrentSessionSection(); InitStaticTelemetryProperties(); } if (telemetryUploader.IsTelemetryConfigured && instancesCounter.IsPrimaryInstance) { this.workerCancellation = new CancellationTokenSource(); this.workerCancellationTask = new TaskCompletionSource <int>(); this.worker = TaskUtils.StartInThreadPoolTaskScheduler(Worker); } }
public SelectionManager( IView view, ISearchResultModel searchResultModel, // todo: try get rid of this dependency IScreenBuffer screenBuffer, LJTraceSource tracer, IPresentationDataAccess presentationDataAccess, IClipboardAccess clipboard, IScreenBufferFactory screenBufferFactory, IBookmarksFactory bookmarksFactory ) { this.view = view; this.searchResultModel = searchResultModel; this.screenBuffer = screenBuffer; this.clipboard = clipboard; this.presentationDataAccess = presentationDataAccess; this.tracer = tracer; this.searchResultModel = searchResultModel; this.screenBufferFactory = screenBufferFactory; this.bookmarksFactory = bookmarksFactory; this.searchResultInplaceHightlightHandler = SearchResultInplaceHightlightHandler; }
public FactoryUI(Factory factory, ILogSourcesManager logSources, IRecentlyUsedEntities recentlyUsedLogs, ITraceSourceFactory traceSourceFactory) { this.trace = traceSourceFactory.CreateTraceSource("UI"); this.factory = factory; this.logSources = logSources; this.recentlyUsedLogs = recentlyUsedLogs; InitializeComponent(); recentPeriodCounterPresenter = new Presenters.LabeledStepperPresenter.Presenter(recentPeriodCounter); this.recentPeriodCounterPresenter.MaxValue = 2147483647; this.recentPeriodCounterPresenter.MinValue = 1; this.recentPeriodCounterPresenter.Value = 1; this.recentPeriodCounterPresenter.AllowedValues = new int[0]; var mostRecentConnectionParams = FindMostRecentConnectionParams(); if (mostRecentConnectionParams != null) { PrefillAccountFields(mostRecentConnectionParams); } SetInitialDatesRange(); UpdateControls(); }
internal ScreenBuffer( IChangeNotification changeNotification, double viewSize, LJTraceSource trace = null, bool disableSingleLogPositioningOptimization = false ) { this.changeNotification = changeNotification; this.buffers = new Dictionary <IMessagesSource, SourceBuffer>(); this.entries = ImmutableArray.Create <ScreenBufferEntry>(); this.disableSingleLogPositioningOptimization = disableSingleLogPositioningOptimization; this.trace = trace ?? LJTraceSource.EmptyTracer; this.sources = Selectors.Create( () => buffersVersion, _ => (IReadOnlyList <SourceScreenBuffer>)ImmutableArray.CreateRange(buffers.Select(b => new SourceScreenBuffer { Source = b.Key, Begin = b.Value.BeginPosition, End = b.Value.EndPosition })) ); this.bufferPosition = CreateBufferPositionSelector(); this.SetViewSize(viewSize); }