Exemplo n.º 1
0
        /// <summary>
        /// 创建运行日志信息
        /// </summary>
        /// <param name="runtimeLogModel">运行日志</param>
        /// <returns>运行日志信息</returns>
        public async Task <RuntimeLogInfo> CreateAsync(RuntimeLogModel runtimeLogModel)
        {
            runtimeLogModel.NotNull("运行日志不能为空");
            var runtimeLogInfo = new RuntimeLogInfo
            {
                FCallMemberName = runtimeLogModel.FCallMemberName,
                FContent        = runtimeLogModel.FContent,
                FCreateTime     = DateTimeUtil.Now,
                FExecuteTime    = runtimeLogModel.FExecuteTime,
                FIsDeleted      = false,
                FLogLevel       = runtimeLogModel.FLogLevel,
                FProjectName    = runtimeLogModel.FProjectName,
                FServicerMac    = runtimeLogModel.FServerMac,
                FSource         = runtimeLogModel.FSource,
                FRequestGuid    = runtimeLogModel.FRequestGuid
            };

            if (runtimeLogInfo.FProjectName.IsNotNullAndNotEmptyWhiteSpace())
            {
                runtimeLogInfo.FProjectID = await _projectDomainService.GetProjectIDAsync(runtimeLogInfo.FProjectName);
            }
            if (runtimeLogInfo.FServicerMac.IsNotNullAndNotEmptyWhiteSpace())
            {
                runtimeLogInfo.FServicerID = await _servicerDomainService.GetServerIDAsync(runtimeLogInfo.FServicerMac);
            }
            return(runtimeLogInfo);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 新增运行日志
 /// </summary>
 /// <param name="runtimeLogModel">运行日志信息</param>
 /// <returns>操作结果</returns>
 public Task <OperateResult> AddLogAsync(RuntimeLogModel runtimeLogModel)
 {
     return(OperateUtil.ExecuteAsync(async() =>
     {
         var runtimeLogInfo = await _runtimeLogDomainService.CreateAsync(runtimeLogModel);
         var id = (await _runtimeLogRepository.InsertOneAsync(runtimeLogInfo, keyName: "FID", ignoreFields: FID)).ToSafeInt32(0);
         runtimeLogInfo.FID = id;
         await _runtimeLogDomainService.AnalysisLogAsync(runtimeLogInfo);
     }, callMemberName: "RuntimeLogApplication-AddLogAsync"));
 }