/// <summary> /// Run and Stop Without Flush /// </summary> static void StopWithFlushTest() { ILog logger2 = new AsyncLog(); for (int i = 0; i < 1000; i++) { logger2.Write("Number with Flush: " + i.ToString()); if (i == 500) { logger2.StopWithFlush(); } } logger2.CloseStreamWriter(); Thread.Sleep(2000); }
/// <summary> /// Run the task and change the date dynamicly /// </summary> void DoWork() { ILog logger2 = new AsyncLog(); for (int i = 1000; i > 0; i--) { logger2.Write("Number with No flush: " + i.ToString()); if (i == 500) { ChangeCurrentDate.ChangeDatetoTommorrow(); } Thread.Sleep(20); } logger2.CloseStreamWriter(); Thread.Sleep(5000); }
/// <summary> /// If the works are done completely add "finish" to the last line /// </summary> static void DoWork() { ILog logger = new AsyncLog(); for (int i = 0; i < 15; i++) { logger.Write("Number with Flush: " + i.ToString()); Thread.Sleep(50); } logger.Write("Finish"); ILog logger2 = new AsyncLog(); for (int i = 100; i > 0; i--) { logger2.Write("Number with No flush: " + i.ToString()); Thread.Sleep(20); } logger2.Write("Finish"); logger.CloseStreamWriter(); logger2.CloseStreamWriter(); Thread.Sleep(5000); }