static void Init() { // build the log viewer window and set title, also init logwatch to null for first run LogWatcher window = ( LogWatcher )EditorWindow.GetWindow(typeof(LogWatcher)); window.title = "Log Watcher"; }
public LogUserControl() { _logWatcher = new LogWatcher(); _logWatcher.Updated += LogWatcherOnUpdated; InitializeComponent(); }
private void enableLogWatcher(bool enable) { try { if (logWatcher != null) { logWatcher.Close(); } if (enable) { logWatcher = new LogWatcher(); foreach (Player player in players) { logWatcher.Add(player.LogDir, "_Event.*.txt"); logWatcher.Add(player.LogDir, "_Skills.*.txt"); logWatcher.PollInterval = 5000; } logWatcher.FileNotify += new LogWatcher.FileNotificationEventHandler(logWatcher_FileNotify); } else { logWatcher = null; } } catch (Exception e) { MessageBox.Show(e.Message); } }
// Minimize to system tray when application is closed. protected override void OnClosing(CancelEventArgs e) { // if hideOnClose // setting cancel to true will cancel the close request // so the application is not closed if (Properties.Settings.Default.hideOnClose && !this.trayClose) { e.Cancel = true; this.Hide(); base.OnClosing(e); } if (!Properties.Settings.Default.hideOnClose || this.trayClose) { ni.Visible = false; MouseHook.Stop(); HotkeysManager.ShutdownSystemHook(); Properties.Settings.Default.Save(); if (LogWatcher.WorkerThread != null && LogWatcher.WorkerThread.IsAlive) { LogWatcher.StopWatchingLogFile(); } //overlay.Close(); //stashTabOverlay.Close(); App.Current.Shutdown(); } }
private void Start() { ticks = 0; actions = 0; actionStart = -1; actionEnd = -1; totalSkill = 0; totalTime = 0; skillTime = 0; rel = 0; srel = 0; trel = 0; UpdateDisplay(); if (logWatcher != null) { logWatcher.Close(); } logWatcher = new LogWatcher(); logWatcher.Add(player.LogDir, "_Event.*.txt"); logWatcher.Add(player.LogDir, "_Skills.*.txt"); logWatcher.PollInterval = 500; logWatcher.Notify += new LogWatcher.NotificationEventHandler(logWatcher_Notify); }
public void Run() { string outputPath = _operation.GetOutputPath(_operationParameters); FileUtils.DeleteDirectoryIfExists(outputPath); bool readLogFile = _operation.ShouldReadOutputFromLogFile() && _operationParameters.Target is Project; if (readLogFile) { Project project = _operationParameters.Target as Project; LogWatcher logWatcher = new LogWatcher(project, _operation.GetLogsPath(_operationParameters)); logWatcher.LineLogged += HandleLogLine; } _process = _operation.Execute(_operationParameters, (o, args) => { HandleLogLine(args.Data); }, (o, args) => { Output?.Invoke(args.Data, LogVerbosity.Error); }, (o, args) => { OnProcessEnded(); }); if (_operationParameters.WaitForAttach) { Output?.Invoke("-WaitForAttach was specified, attach now", LogVerbosity.Log); } }
public void LoadState(bool forcePickFolder = false) { LogDirectory = IOUtils.RetrieveLogDirectory(forcePickFolder, LogDirectory); LogWatcher?.Dispose(); LogWatcher = new LogWatcher(LogDirectory); var allLogs = LogWatcher.RetrieveAllLogs(); Commanders.Clear(); var entryDatas = JsonConvert.DeserializeObject <List <EntryData> >(IOUtils.GetEntryDatasJson()); foreach (var commander in allLogs.Keys) { // some file contains only one line unrelated to anything, could generate Dummy Commander if we don't skip if (allLogs[commander].Count <= 1) { continue; } var commanderState = new CommanderViewModel(commander, allLogs[commander], Languages, entryDatas); Commanders[commander] = commanderState; } if (Commanders.Count == 0) // we found absolutely nothing { Commanders[LogWatcher.DEFAULT_COMMANDER_NAME] = new CommanderViewModel(LogWatcher.DEFAULT_COMMANDER_NAME, new List <string>(), Languages, entryDatas); } if (Commanders.Any(k => k.Key == SettingsManager.SelectedCommander)) { CurrentCommander = Commanders.First(k => k.Key == SettingsManager.SelectedCommander); } else { CurrentCommander = Commanders.First(); } LogWatcher.InitiateWatch(logs => { Application.Current.Dispatcher.Invoke(() => { if (logs.Item2.Count == 0) { return; } if (Commanders.ContainsKey(logs.Item1)) { Commanders[logs.Item1].ApplyEventsToSate(logs.Item2); } else if (logs.Item1 != LogWatcher.DEFAULT_COMMANDER_NAME) { var commanderState = new CommanderViewModel(logs.Item1, logs.Item2, Languages, entryDatas); Commanders[logs.Item1] = commanderState; } }); }); }
static void Main(string[] args) { try { Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); CheckForUpgradeSettings(); string dataMartClientId = Properties.Settings.Default.DataMartClientId; if (dataMartClientId == null || dataMartClientId == string.Empty) { dataMartClientId = Properties.Settings.Default.DataMartClientId = Guid.NewGuid().ToString().ToUpper(); } log4net.GlobalContext.Properties["LogFilePath"] = Properties.Settings.Default.LogFilePath; XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)); logWatcher = new LogWatcher(Properties.Settings.Default.LogLevel, Properties.Settings.Default.LogFilePath, dataMartClientId); log.Info("Started DataMart Client Application"); SystemInfo.LogUserMachineInfo(); Configuration.LogNetworkSettingsFile(); log.Info("Check for single instance"); CheckForShortcut(); if (!SingleInstanceChecker.Start()) { StartupParams.WriteStartupParamsToFile(args); SingleInstanceChecker.ShowFirstInstance(); return; } Dictionary <string, string> AddNetworkStartupParamsDict = StartupParams.GetAddNetworkStartupParamsDictionary(StartupParams.GetStartupParamsXml(args)); log.Info("Run instance"); System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12 | System.Net.SecurityProtocolType.Tls11 | System.Net.SecurityProtocolType.Tls; System.Net.ServicePointManager.CheckCertificateRevocationList = true; System.Net.ServicePointManager.ServerCertificateValidationCallback += delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { ////Commented out for removal of Thumprint Check // return ValidateCertificate((System.Net.HttpWebRequest)sender, certificate, chain); return(true); }; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new RequestListForm(AddNetworkStartupParamsDict)); } catch (Exception ex) { log.Fatal("Following error occured starting DataMartClient: " + ex.Message, ex); MessageBox.Show("Error occured starting DataMartClient. Please contact administrator.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } SingleInstanceChecker.Stop(); }
public void SetFilePath(string path) { Path = path; DisplayName = System.IO.Path.GetFileName(path); LogWatcher?.Dispose(); LogWatcher = new LogWatcher(this, path); }
static void Init() { // build the log viewer window and set title LogViewer window = ( LogViewer )EditorWindow.GetWindow(typeof(LogViewer)); window.title = "Log Viewer"; logWatch = null; }
public ShellViewModel() { LogWatcher = new LogWatcher(); SelectedFolder = Properties.Settings.Default.SelectedFolder; if (!string.IsNullOrEmpty(SelectedFolder)) { LogWatcher.StartWatching(SelectedFolder); } }
private void Window_ContentRendered(object sender, EventArgs e) { this.SizeToContent = SizeToContent.Manual; logbox.Height = Double.NaN; // Create a LogFileWatcher to display the log and bind the log textbox to it logWatcher = LogWatcher.get(); logWatcher.LogEvent += logWatcher_LogEvent; log.Info("Display logmessages in textbox"); }
public OutputViewModel() { ViewLocator.AddNamespaceMapping(typeof(OutputViewModel).Namespace, typeof(OutputView).Namespace); DisplayName = Resources.FactorioLogOutputTitle; StringBuilder = new StringBuilder(); Writer = new OutputWriter(this); LogWatcher = new LogWatcher(this, new FactorioLogFile().Path); }
public void Initialize(string kcdDirectory) { ScriptInjector.SetBridgeFilePath($@"{kcdDirectory}\mods\KCD_Bootloader\invoke_command.txt"); KCDLogPath = $@"{kcdDirectory}\kcd.log"; BootloaderCommandLogPath = $@"{kcdDirectory}\mods\KCD_Bootloader\command_log.txt"; LogWatcher = LogWatcher.CreateDefault(KCDLogPath); LogWatcher.Start(); }
private void buttonRefresh_Click(object sender, EventArgs e) { string selected = (string)comboLogs.SelectedItem; string[] logNames = LogWatcher.GetLogNames(); comboLogs.DataSource = logNames; if (logNames.Contains(selected)) { comboLogs.SelectedItem = selected; } }
public void BrowseButton() { var dialog = new Avalon.Windows.Dialogs.FolderBrowserDialog(); var hasResult = dialog.ShowDialog(); if (hasResult.HasValue && hasResult.Value) { SelectedFolder = dialog.SelectedPath; LogWatcher.StartWatching(SelectedFolder); } }
public new virtual void Hide() { IsOpen = false; if (LogWatcher.WorkerThread != null && LogWatcher.WorkerThread.IsAlive) { LogWatcher.StopWatchingLogFile(); } //aTimer.Enabled = false; //((MainWindow)System.Windows.Application.Current.MainWindow).RunButtonContent = "Run Overlay"; base.Hide(); }
public void Start() { if (logWatcher != null) { logWatcher.Close(); } logWatcher = new LogWatcher(); logWatcher.Add(player.LogDir, "_Event.*.txt"); logWatcher.PollInterval = 500; logWatcher.Notify += new LogWatcher.NotificationEventHandler(logWatcher_Notify); }
public void ShowWatches(bool show) { if (show) { logWatch = ( LogWatcher )EditorWindow.GetWindow(typeof(LogWatcher)); logWatch.title = "Log Watches"; } else { logWatch.Close( ); logWatch = null; } }
public LogWatcherManager() { _logWatcher = new LogWatcher(new [] { PowerLogWatcherInfo, RachelleLogWatcherInfo, ArenaLogWatcherInfo, LoadingScreenLogWatcherInfo, FullScreenFxLogWatcherInfo }); _logWatcher.OnNewLines += OnNewLines; _logWatcher.OnLogFileFound += OnLogFileFound; _logWatcher.OnLogLineIgnored += OnLogLineIgnored; _loadingScreenHandler.OnHearthMirrorCheckFailed += OnHearthMirroCheckFailed; }
protected void init() { this.LogLines = new List <String>(); this.CopyLogLines = new List <String>(); _logFilePath = Config.hsLogDirPath + _logFileName; _offset = 0; _sem = new BinarySemaphore(0, 1); _matchIndex = 0; File.WriteAllText(_logFilePath, String.Empty); _logWatcher = new LogWatcher(_logFileName.Substring(1), ref _sem); _logWatcher.start(); this._regexList = new List <Regex>(); }
protected void init() { this.LogLines = new List<String>(); this.CopyLogLines = new List<String>(); _logFilePath = Config.hsLogDirPath + _logFileName; _offset = 0; _sem = new BinarySemaphore(0, 1); _matchIndex = 0; File.WriteAllText(_logFilePath, String.Empty); _logWatcher = new LogWatcher(_logFileName.Substring(1), ref _sem); _logWatcher.start(); this._regexList = new List<Regex>(); }
public void should_log_if_item_is_null() { // Arrange var args = new ProcessIntegrationItemArgs { IntegrationItemID = ID.NewID, SynchContext = this.CreateSynchContext() }; // Act var logWatcher = new LogWatcher(() => this.processor.Process(args)); // Assert logWatcher.Ensure() .LevelIs(LogNotificationLevel.Warning) .MessageIs( "Can't get item '{0}' from database '{1}'".FormatWith(args.IntegrationItemID, args.SynchContext.Database)); }
public new virtual void Show() { IsOpen = true; if (Properties.Settings.Default.AutoFetch) { Watcher = new LogWatcher(); } //FetchButtonBottomText = "Start"; //if (FetchingActive) //{ // aTimer.Enabled = true; // //FetchData(); // //FetchButtonBottomText = "Stop"; //} //((MainWindow)System.Windows.Application.Current.MainWindow).RunButtonContent = "Stop Overlay"; base.Show(); }
public void should_log_if_sync_pipeline_throws() { // Arrange var exc = new Exception("Pipeline is not work"); using (new PipelinesHandler().ThrowInPipeline(PipelineNames.SynchronizeTree, exc)) { var synchContext = new SynchContext(new ItemMock().AsConfigurationItem()); // Act var logWatcher = new LogWatcher(() => IntegrationPipelinesRunner.SynchronizeTree(ProcessIntegrationItemsOptions.DefaultOptions, synchContext)); // Assert logWatcher.Ensure() .LevelIs(LogNotificationLevel.Error) .MessageIs(string.Format("Sharepoint Provider can't process tree.{2}Integration config item ID: {0}, {1}", synchContext.ParentID, "Web: server List: list", Environment.NewLine)) .ExceptionIs(exc); } }
public FormMain() { InitializeComponent(); Rectangle bounds = Screen.AllScreens.Last().Bounds; Top = bounds.Top; Left = bounds.Left; Width = bounds.Width; _CitadelLogs = new DataTable(); _CitadelLogs.Columns.Add("Text", typeof(string)); _CitadelLogs.Columns.Add("System", typeof(string)); dataGridIntel.DataSource = _CitadelLogs; logWatcherIntel.LogName = Settings.Default.intelLogName; comboLogs.DataSource = LogWatcher.GetLogNames(); comboLogs.SelectedItem = Settings.Default.intelLogName; comboLogs.SelectedIndexChanged += comboLogs_SelectedIndexChanged; numMaxVisibleSystems.Value = Settings.Default.maxVisibleSystems; numMaxVisibleSystems.ValueChanged += numMaxVisibleSystems_ValueChanged; _ComboBoxSystemsSetValue = true; comboBoxSystems.DataSource = DbHelper.DataContext.SolarSystems.ToArray(); _ComboBoxSystemsSetValue = false; if (Settings.Default.currentSystemId != 0) { SolarSystem solarSystem = DbHelper.DataContext.SolarSystems.First(o => o.Id == Settings.Default.currentSystemId); map.CurrentSystemName = solarSystem.SolarSystemName; _ComboBoxSystemsSetValue = true; comboBoxSystems.SelectedItem = solarSystem; _ComboBoxSystemsSetValue = false; } hotkeyControlKosCheck.Hotkey = Settings.Default.kosCheckKey & ~cModifiers; hotkeyControlKosCheck.HotkeyModifiers = Settings.Default.kosCheckKey & cModifiers; InitHook(); }
public void should_correct_log_soap_exception() { // Arrange var document = new XmlDocument(); document.LoadXml("<details>DetailsInfo</details>"); var exc = new SoapException("Pipeline is not work", new XmlQualifiedName(), "actor", document.ChildNodes[0]); using (new PipelinesHandler().ThrowInPipeline(PipelineNames.SynchronizeTree, exc)) { var synchContext = new SynchContext(new ItemMock().AsConfigurationItem()); // Act var logWatcher = new LogWatcher(() => IntegrationPipelinesRunner.SynchronizeTree(ProcessIntegrationItemsOptions.DefaultOptions, synchContext)); // Assert logWatcher.Ensure() .Message.Should() .EndWith(string.Format("{1}{0}", exc.Detail.InnerText, Environment.NewLine)); } }
public void ConfigureServices(IServiceCollection services) { Thread.Sleep(20000); services.Configure <ConsumerSettings>(Configuration); services.AddControllers(); services.AddSingleton <ConnectionMultiplexer>(sp => { var settings = sp.GetRequiredService <IOptions <ConsumerSettings> >().Value; var configuration = ConfigurationOptions.Parse(settings.ConnectionStrings.RedisCache, true); configuration.ResolveDns = true; return(ConnectionMultiplexer.Connect(configuration)); }); services.AddSingleton <ZooKeeper>(sp => { var settings = sp.GetRequiredService <IOptions <ConsumerSettings> >().Value; var logger = sp.GetRequiredService <ILogger <LogWatcher> >(); var watcher = new LogWatcher(logger); return(new ZooKeeper(settings.ConnectionStrings.ZooKeeper, 30000, watcher)); }); services.AddSingleton <MongoDb>(); if (Environment.GetEnvironmentVariable("USE_REDIS_DISTRIBUTED_LOCK") == "1") { services.AddScoped <IDistributedLock, RedisCacheDistributedLock>(); } if (Environment.GetEnvironmentVariable("USE_ZOOKEEPER_DISTRIBUTED_LOCK") == "1") { services.AddScoped <IDistributedLock, ZooKeeperDistributedLock>(); } services.AddScoped <ITransactionRepository, TransactionRepository>(); services.AddHostedService <ProcessTransactionsHostedService>(); }
public void ViewTrainingOutput() { var mlContext = new MLContext(seed: 1); // Attach a listener. var logWatcher = new LogWatcher(); mlContext.Log += logWatcher.ObserveEvent; // Get the dataset. var data = mlContext.Data.LoadFromTextFile <HousingRegression>(GetDataPath(TestDatasets.housing.trainFilename), hasHeader: true); // Define a pipeline var pipeline = mlContext.Transforms.Concatenate("Features", HousingRegression.Features) .Append(mlContext.Transforms.Normalize()) .AppendCacheCheckpoint(mlContext) .Append(mlContext.Regression.Trainers.Sdca( new SdcaRegressionTrainer.Options { NumberOfThreads = 1, MaximumNumberOfIterations = 20 })); // Fit the pipeline to the data. var model = pipeline.Fit(data); // Validate that we can read lines from the file. var expectedLines = new string[3] { @"[Source=SdcaTrainerBase; Training, Kind=Info] Auto-tuning parameters: L2 = 0.001.", @"[Source=SdcaTrainerBase; Training, Kind=Info] Auto-tuning parameters: L1Threshold (L1/L2) = 0.", @"[Source=SdcaTrainerBase; Training, Kind=Info] Using best model from iteration 7." }; foreach (var line in expectedLines) { Assert.Contains(line, logWatcher.Lines); Assert.Equal(1, logWatcher.Lines[line]); } }
protected override void OnDeactivate(bool close) { base.OnDeactivate(close); LogWatcher.Dispose(); }
public OutputLoggerService(JoinableTaskFactory joinableTaskFactory, LogWatcher logWatcher) { _joinableTaskFactory = joinableTaskFactory; _logWatcher = logWatcher; }