Example #1
0
        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;
            }
        }
 public FixActionHandlerLoggerItem(IActivityDiscrepancyFixer fixer)
 {
     HandlerType = fixer.GetType().FullName;
     StartTime   = DateTime.Now;
 }