public bool AddTaskError(int taskId, string msg, Exception ex) { Model.Task task = _TaskRepository.GetTask(taskId); Model.TaskLog log = new Model.TaskLog() { LogType = Storage.Constants.LogType.SystemError, NodeId = task.Node.Id, TaskId = taskId, CreateTime = DateTime.Now, Content = string.Format(@"{0},错误信息:{1},堆栈信息:{2}", msg, ex.Message, ex.StackTrace) }; _TaskLogRepository.Add(log); _TaskLogRepository.Context.Commit(); return true; }
public bool AddTaskLog(int taskId, string msg) { Model.Task task = _TaskRepository.GetTask(taskId); Model.TaskLog log = new Model.TaskLog() { LogType = Storage.Constants.LogType.SystemLog, NodeId = task.Node.Id, TaskId = taskId, CreateTime = DateTime.Now, Content = msg }; _TaskLogRepository.Add(log); _TaskLogRepository.Context.Commit(); return true; }