/// <summary> /// Log to disk events generated by the Spider (mostly reporting on success/fail of page load/index) /// </summary> public static void OnProgressLogEvent(object source, ProgressEventArgs pea) { //if (pea.Level < 3) //{ // Console.WriteLine(pea.Message + "<br>"); //} }
/// <summary> /// Handle events generated by the Spider (mostly reporting on success/fail of page load/index) /// </summary> public static void OnProgressEvent(object source, ProgressEventArgs pea) { if (pea.Level <= clip.Verbosity) { switch (pea.Level) { case 2: ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.Grey); break; case 3: ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.Yellow); break; case 4: ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.Red); break; case 5: ConsoleColour.SetForeGroundColour(ConsoleColour.ForeGroundColour.Magenta); break; default: ConsoleColour.SetForeGroundColour(); break; } Console.WriteLine(">{0} :: {1}", pea.Level, pea.Message); } }
/// <summary> /// Only trigger the event if a Handler has been attached. /// </summary> private void ProgressEvent(object sender, ProgressEventArgs pea) { if (this.SpiderProgressEvent != null) { SpiderProgressEvent(sender, pea); } }