public LogDto AddExceptionLog(ExceptionLogDto LogDto) { User user = null; //this check must be move to domain servi if (!string.IsNullOrWhiteSpace(LogDto.UserName)) user = _userRep.GetUserById(LogDto.UserName)as User; var log = _logService.AddExceptionLog(LogDto.Code, LogLevel.FromName(LogDto.LogLevel), user, LogDto.ClassName, LogDto.MethodName, LogDto.Title, LogDto.Messages); return logDtoMapper.MapToModel(log); }
public async Task LogException(ExceptionLogDto dto) { using (var ctx = _contextFactory.ConstructContext()) { var ent = dto.ToEntity(); await ctx.AddAsync(ent); await ctx.SaveChangesAsync(true); } }
//[Route("writeExceptionLog")] public void WriteExceptionLog(ExceptionLogDto model) { try { if (model.SecretKey == _projectSetting.Value.SecretKey) { _logService.WriteExceptionLog(model); } } catch { } }
internal static LogHeaderEntity ToEntity(this ExceptionLogDto dto) { if (dto == null) { return(null); } return(new LogHeaderEntity { Level = (int)dto.Level, Timestamp = DateTimeOffset.UtcNow, Details = dto.Ex.ToEntities() }); }
public ServiceReturnDto WriteExceptionLog(ExceptionLogDto log) { Sys_Error_Log entity = new Sys_Error_Log() { ActionName = log.ActionName, ControllerName = log.ControllerName, HttpType = log.HttpType, IPAddress = log.IpAddress, LoginID = log.LoginId, LoginName = log.LoginName, Parameters = log.Parameter, URL = log.Url, SystemName = log.SystemName, Message = log.ErrorMessage }; _unitOfWork.SysErrorLogRep.Insert(entity); return(null); }