Esempio n. 1
0
        public async Task AddLog(AddLogRequest request)
        {
            await using var dataContext = await _dataContextFactory.Construct();

            var logsDataBridge = dataContext.GetLogsDataBridge();
            await logsDataBridge.AddLogAsync(request);
        }
Esempio n. 2
0
        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)));
            }
        }
Esempio n. 3
0
        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()));
        }
Esempio n. 4
0
        private async Task ProcessLog(AddLogRequest request)
        {
            try
            {
                // web request to Deployr.Web

                await Task.FromResult(1);
            }
            catch (Exception)
            {
                // on failure requeue
                _loggingQueue.Enqueue(request);
            }
        }
Esempio n. 5
0
        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();
        }
Esempio n. 6
0
 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);
 }
Esempio n. 7
0
 public ActionResult AddLog(AddLogRequest request)
 {
     _logService.AddLog(request.message, request.obj);
     return(NoContent());
 }
Esempio n. 8
0
 public bool TryDequeue(out AddLogRequest request)
 {
     return(requests.TryDequeue(out request));
 }
Esempio n. 9
0
 public void Enqueue(AddLogRequest request)
 {
     requests.Enqueue(request);
 }