private Task LogFixerCall( IActivityDiscrepancyFixer fixer, ActivityDiscrepancy discrepancy, FixActionLoggerItem logItem, CancellationToken cancellationToken) { var handlerLogItem = new FixActionHandlerLoggerItem(fixer); logItem.Add(handlerLogItem); var sw = new Stopwatch(); sw.Start(); try { return(fixer.FixAsync(discrepancy, cancellationToken)); } catch (Exception e) { handlerLogItem.Error = $"{e.GetType().Name} - {e.Message}"; throw; } finally { sw.Stop(); handlerLogItem.FixMSecs = sw.ElapsedMilliseconds; } }
private static FixActionLoggerItem CreateLogItem(FixActionLogger logger, ActivityDiscrepancyType discrepancyType) { var newItem = new FixActionLoggerItem { Discrepancy = discrepancyType }; logger.Add(newItem); return(newItem); }