Esempio n. 1
0
        public static async Task ExecuteActionsAsync(
            Guid activityId,
            TraceType traceType,
            IList <IAction> actions)
        {
            traceType.Validate("traceType");
            actions.Validate("actions");

            var exceptions = new List <Exception>();

            foreach (var action in actions)
            {
                try
                {
                    traceType.WriteInfo("{0} Start: {1}", activityId, action);
                    await action.ExecuteAsync(activityId).ConfigureAwait(false);

                    traceType.WriteInfo("{0} Finish: {1}", activityId, action);
                }
                catch (Exception ex)
                {
                    traceType.WriteWarning("{0} Error: {1}{2}Exception: {3}", activityId, action, Environment.NewLine, ex);
                    exceptions.Add(ex);
                }
            }

            if (exceptions.Count > 0)
            {
                throw new AggregateException(exceptions);
            }
        }
Esempio n. 2
0
 public TraceActivitySubject(TraceType traceType)
 {
     this.traceType = traceType.Validate("traceType");
 }
 public IActivityLogger Create(TraceType traceType)
 {
     return(new TraceActivitySubject(traceType.Validate("traceType")));
 }