/// <summary> /// Creates <see cref="ExceptionDto"/> from <see cref="Exception"/> /// </summary> public static ExceptionDto Create(Exception e) { if (e == null) { throw new ArgumentNullException(nameof(e)); } var dto = new ExceptionDto { Message = e.Message, StackTrace = e.StackTrace, Type = e.GetType().FullName }; if (e is AggregateException ae) { dto.Aggregated = ae.InnerExceptions.Select(Create).ToArray(); } if (e.InnerException != null) { dto.Inner = Create(e.InnerException); } var eLogData = new ExceptionLogData(e); dto.Facts = new LogFacts(eLogData.GetFacts()); dto.Labels = new LogLabels(eLogData.GetLabels()); return(dto); }
/// <summary> /// Initializes a new instance of <see cref="LogEntity"/> /// </summary> public LogEntity(LogEntity origin) { Facts = new LogFacts(origin.Facts); Labels = new LogLabels(origin.Labels); Time = origin.Time; Message = origin.Message; Exception = origin.Exception; }