public static void RunProbe() { try { using (Probe p = new Probe()) { p.Init(); while (p.DoStep()) ; } } catch (Exception ex) { //logger.LogFormat("[Error] {0},{1},{2},{3}", Thread.CurrentThread.IsThreadPoolThread, Thread.CurrentThread.ManagedThreadId, Thread.CurrentThread.Name, Thread.CurrentThread.GetApartmentState()); Log.Error(ex); } }
private void ExecuteStep(Probe.Step step) { step.StartTime = DateTime.Now; var timer = System.Diagnostics.Stopwatch.StartNew(); try { _browser.GoTo(step.Url); } catch (Exception ex) { step.Error = true; step.ErrorMessage = ex.ToString(); } timer.Stop(); step.ElapsedTime = timer.ElapsedMilliseconds; }
private void WriteLog(Probe.Step step, int index) { Log.InfoFormat("Step {0}, {1} ms{2}", index, step.ElapsedTime, step.Error ? ", error" : ""); Csv.Log(index, step.ElapsedTime); if (step.ElapsedTime > warnTresh) Log.WarnFormat("Step {0} {1} ms > {2} ms", index, step.ElapsedTime, warnTresh); if (step.Error) Log.Error(step.ErrorMessage); }