public void OnAfter(ExecutionArgs executionArgs) { UpdateMemory(executionArgs); foreach (var item in _memoryThreads.Where(x => x.ActiveThread.IsAlive == false)) { Timings.Add(item); } }
public void LogToConsole(ExecutionArgs args) { _logModel = new LogModel(args); Process(() => { _logger = new SystemLogger(); _logger.Log(_logModel); }); }
public void LogToMSSQL(ExecutionArgs args, ADOConnection connection, string TableName = "") { _logModel = new LogModel(args); _logModel.TableName = GetNameOfLog(TableName); Process(() => { _logger = new SQLManager(connection); _logger.Log(_logModel); }); }
public void LogToMongoDB(ExecutionArgs args, MongoConnection mongoConnection, string collectionName = "") { _logModel = new LogModel(args); _logModel.CollectionName = GetNameOfLog(collectionName); Process(() => { _logger = new MongoManager(mongoConnection); _logger.Log(_logModel); }); }
public void LogToFile(ExecutionArgs args, string folderPath) { _logModel = new LogModel(args); _logModel.FolderPath = folderPath; Process(() => { _logger = new FileManager(); _logger.Log(_logModel); }); }
public TStackMongoLog(ExecutionArgs executionArgs) { MethodInfo = executionArgs.MethodInfo; Arguments = executionArgs.Arguments; Exception = executionArgs.Exception; Total = executionArgs.Total; Result = executionArgs.Result; Childs = executionArgs.Childs; ExecutionLevel = executionArgs.ExecutionLevel.ToString(); LogDate = DateTime.Now; }
public override void OnSuccess(ExecutionArgs executionArgs) { foreach (var item in Timings) { ConsoleLog(item); if (item.HasChilds()) { foreach (var child in item.Childs) { ConsoleLog(child); } } ConsoleHR(); } }
private void AddToMemory(ExecutionArgs executionArgs) { var existThread = _memoryThreads.FirstOrDefault(x => x.ActiveThread.ManagedThreadId == executionArgs.ActiveThread.ManagedThreadId); //base log if (existThread == null) { _memoryThreads.Add(executionArgs); } else //child log { if (existThread.Childs == null) { existThread.Childs = new List <ExecutionArgs>(); } existThread.Childs.Add(executionArgs); } }
/// <summary> /// Async wrapper for OptionHelper.RunScriptAsync. /// </summary> protected async Task <int> Execute(ExecutionArgs args, TaskToken task) { var outputBuilder = new StringBuilder(); var errorBuilder = new StringBuilder(); int?exitcode = null; var terminator = OptionHelper.RunScriptAsnyc( args.startInfo, args.input, (output) => { outputBuilder.AppendLine(output); args.onOutput?.Invoke(output); }, (error) => { errorBuilder.AppendLine(error); args.onError?.Invoke(error); }, (code) => { exitcode = code; } ); while (exitcode == null) { if (task.cancellation.IsCancellationRequested) { terminator(true); task.ThrowIfCancellationRequested(); } await Task.Yield(); } // 137 happens for Kill() and 143 for CloseMainWindow(), // which means the script has been canceled if (!args.silentError && exitcode != 0 && exitcode != 137 && exitcode != 143) { throw new Exception(string.Format( "{0}: Failed to execute {1} (code {2}): {3}\nOutput: {4}", name, Path.GetFileName(args.startInfo.FileName), exitcode, errorBuilder.ToString(), outputBuilder.ToString() )); } return(exitcode.Value); }
public abstract void OnAfter(ExecutionArgs executionArgs);
public void OnExit(ExecutionArgs executionArgs) { DeleteThreads(); }
private void UpdateMemory(ExecutionArgs executionArgs) { var process = _memoryThreads.FirstOrDefault(x => x.ActiveThread.ManagedThreadId == executionArgs.ActiveThread.ManagedThreadId); process.Fill(executionArgs); }
public override void OnBefore(ExecutionArgs executionArgs) { Console.WriteLine("On Before"); }
public override void OnSuccess(ExecutionArgs executionArgs) { Console.WriteLine("On Success"); }
public override void OnExit(ExecutionArgs executionArgs) { Console.WriteLine("On Exit"); }
public override void OnAfter(ExecutionArgs executionArgs) { Console.WriteLine("On After"); }
public abstract void OnExit(ExecutionArgs executionArgs);
public abstract void OnException(ExecutionArgs executionArgs);
public void OnBefore(ExecutionArgs executionArgs) { AddToMemory(executionArgs); }
private void ConsoleLog(ExecutionArgs executionArgs) { Console.WriteLine($"Log Name is {executionArgs.NameOfLogger} Instance Name {executionArgs.MethodInfo.ReflectedType.Name} > {executionArgs.MethodInfo.Name } total ms : {executionArgs.Total.Value.TotalMilliseconds}"); }
public abstract void OnBefore(ExecutionArgs executionArgs);
public override void OnException(ExecutionArgs executionArgs) { Console.WriteLine(executionArgs.Exception.Message); }
/// <summary> /// Processes the activity. /// </summary> /// <returns></returns> public override bool ProcessActivity() { List<string> users = new List<string>(); CommandType type = CommandType.Chat; for (int i = 1; i < CallConnection.RemotelyConnectedDevices() + 1; i++) { Person p = CallConnection.DeviceAt(i).DeviceAttachesToPerson(); users.Add(p.PersonID); } foreach (Capability cap in CallConnection.DeviceAt(0).DeviceModel().deviceCapability) { if (cap == Capability.LiveAudio) type = CommandType.VoiceCall; else if (cap == Capability.LiveVideo) type = CommandType.VideoCall; } ExecutionArgs args = new ExecutionArgs(users.ToArray(), type, ""); System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(ExecuteCall)); t.SetApartmentState(System.Threading.ApartmentState.STA); t.Start(args); resetEvent.WaitOne(); return true; }
public abstract void OnSuccess(ExecutionArgs executionArgs);
public LogModel(ExecutionArgs args) { Information = args; }