public static void Call() { GeneralLogger logger = LoggerFactory.Instance.GetLogger("ZJ"); Task[] task = new Task[60]; for (int i = 0; i < 10; i++) { task[i * 6 + 0] = Task.Run(() => logger.Debug($"debug:我尼玛我尼玛我尼玛我尼玛我尼玛我尼玛{i}")); task[i * 6 + 1] = Task.Run(() => logger.Info($"info:我尼玛我尼玛我尼玛我尼玛我尼玛我尼玛{i}")); task[i * 6 + 2] = Task.Run(() => logger.Warn($"warn:我尼玛我尼玛我尼玛我尼玛我尼玛我尼玛{i}")); task[i * 6 + 3] = Task.Run(() => logger.Fatal($"Fatal:我尼玛我尼玛我尼玛我尼玛我尼玛我尼玛{i}")); task[i * 6 + 4] = Task.Run(() => logger.Error($"Error:我尼玛我尼玛我尼玛我尼玛我尼玛我尼玛{i}")); task[i * 6 + 5] = Task.Run(() => logger.Trace($"Trace:我尼玛我尼玛我尼玛我尼玛我尼玛我尼玛{i}")); Thread.Sleep(100); } Task.WaitAll(task); //logger.Debug("我尼玛"); //Console.WriteLine(new StackTrace(true).GetFrame(0).GetFileName()); }
static void Main(string[] args) { var myTestClass = new MyTestClass(); myTestClass.Run(); var logger = new GeneralLogger(); var providerSettings = new TestJobsProviderSettings { SearchInAssemblyName = "AsyncNet.Selenium.Tests" }; var jobsProvider = new TestJobsProvider(providerSettings); var managerSettings = new JobsManagerSettings(); var jobsManager = new TestJobsManager(jobsProvider, managerSettings); jobsManager.OnStart += (s, e) => logger.Info("PROCESS START"); jobsManager.OnFailed += (s, e) => logger.Info("PROCESS FAILED"); jobsManager.OnFinished += (s, e) => logger.Info("PROCESS FINISHED"); jobsManager.OnActionExecuting += (s, e) => logger.Info("START - " + ((TestCaseJob)s).TestCaseType.Name); jobsManager.OnActionExecuted += (s, e) => logger.Info("STOP - " + ((TestCaseJob)s).TestCaseType.Name); jobsManager.OnActionCanceled += (s, e) => logger.Info("CANCELLED - " + ((TestCaseJob)s).TestCaseType.Name); jobsManager.OnActionFailed += (s, e) => logger.Info("FAILED - " + ((TestCaseJob)s).TestCaseType.Name + " Exception: " + e.Exception.ToString()); jobsManager.OnBackActionExecuting += (s, e) => logger.Info("BACK START - " + ((TestCaseJob)s).TestCaseType.Name); jobsManager.OnBackActionExecuted += (s, e) => logger.Info("BACK STOP - " + ((TestCaseJob)s).TestCaseType.Name); jobsManager.OnBackActionFailed += (s, e) => logger.Info("BACK FAILED - " + ((TestCaseJob)s).TestCaseType.Name + " Exception: " + e.Exception.ToString()); jobsManager.OnStateChanged += (s, e) => logger.Info("STATE CHANGED - " + ((TestCaseJob)s).State.ToString() + " - " + ((TestCaseJob)s).TestCaseType.Name); jobsManager.BeginRun(); bool ask = true; while (ask) { Console.WriteLine("c - Cancel, t - Terminate, q - Quit"); var key = Console.ReadKey().KeyChar; switch (key) { case 'c': jobsManager.Cancel(); break; case 't': jobsManager.Terminate(); break; case 'q': ask = false; break; } } }
private static void AddInformation(LogData logData) { GeneralLogger.Info(FormatLogMsg(logData)); }