public async Task AddLog(AddLogRequest request) { await using var dataContext = await _dataContextFactory.Construct(); var logsDataBridge = dataContext.GetLogsDataBridge(); await logsDataBridge.AddLogAsync(request); }
public ResponseBase <EmptyResponse> AddLog(AddLogRequest req) { try { //var node = noderepository.FindSingle(x => x.id == req.NodeId); //if (node == null) //{ // return ResponseToClient<EmptyResponse>(ResponesStatus.Failed, "当前节点" + req.NodeId + "不存在库中!"); //} switch (req.LogType) { case LogType.CommonError: case LogType.SystemError: errorrespository.Add(new tb_error() { errorcreatetime = DateTime.Now, errortype = (int)req.LogType, msg = req.Msg, nodeid = req.NodeId, taskid = req.TaskId }); break; //case LogType.CommonLog: //case LogType.SystemLog: //case LogType.NodeInitLog: // break; case LogType.RefreshCommandQueueLog: //刷新命令队列日志 refreshcommandQueueLogRepository.Add(new tb_refreshcommadqueuelog() { logcreatetime = DateTime.Now, logtype = (int)req.LogType, msg = req.Msg, nodeid = req.NodeId, taskid = req.TaskId }); break; default: logrespository.Add(new tb_log() { logcreatetime = DateTime.Now, logtype = (int)req.LogType, msg = req.Msg, nodeid = req.NodeId, taskid = req.TaskId }); break; } return(ResponseToClient <EmptyResponse>(ResponesStatus.Success, "")); } catch (Exception ex) { return(ResponseToClient <EmptyResponse>(ResponesStatus.Exception, JsonConvert.SerializeObject(ex))); } }
public async Task <IActionResult> AddLog([FromBody] AddLogRequest addLogRequest) { if (!ModelState.IsValid) { throw new Exceptions.WebException(400, "Invalid input"); } await _logsLogic.AddLog(addLogRequest); return(Ok(new BasicResponse())); }
private async Task ProcessLog(AddLogRequest request) { try { // web request to Deployr.Web await Task.FromResult(1); } catch (Exception) { // on failure requeue _loggingQueue.Enqueue(request); } }
public async Task AddLogAsync(AddLogRequest addLogRequest) { var log = new Log(); log.EventType = (EventTypeEnum)addLogRequest.EventType; log.LogType = (LogTypeEnum)addLogRequest.LogType; log.CreatedAt = DateTime.UtcNow; log.Description = addLogRequest.Description; log.UserId = addLogRequest.UserId; log.Module = addLogRequest.Module; log.App = addLogRequest.App; await _uow.LogRepository.AddAsync(log); await _uow.CommitAsync(); }
public async Task AddLogAsync(AddLogRequest request) { var insertCommand = "INSERT INTO logs(deployment_id, log) VALUES (@DeploymentId, @Log);"; await _connection.ExecuteAsync(insertCommand, new { request.DeploymentId, request.Log }).ConfigureAwait(false); }
public ActionResult AddLog(AddLogRequest request) { _logService.AddLog(request.message, request.obj); return(NoContent()); }
public bool TryDequeue(out AddLogRequest request) { return(requests.TryDequeue(out request)); }
public void Enqueue(AddLogRequest request) { requests.Enqueue(request); }