Exemple #1
0
        public static void RunAndLogJob(Action <string> action, string actionName, JobErrorsLogged logErrors = JobErrorsLogged.Automatically)
        {
            string   runId     = CreateRunId();
            DateTime startTime = VirtualDateTime.Now;

            LogFunctionStart(runId, actionName, startTime);
            try
            {
                action(runId);

                LogFunctionEnd(runId, actionName, startTime);
            }
            catch (Exception ex)
            {
                if (logErrors == JobErrorsLogged.Automatically)
                {
                    LogFunctionError(runId, actionName, startTime, ex);
                }

                //Rethrow the error
                throw;
            }
        }
Exemple #2
0
 public static void RunAndLogJob(Action action, string actionName, JobErrorsLogged logErrors = JobErrorsLogged.Automatically)
 {
     RunAndLogJob(unusedRunId => action(), actionName, logErrors);
 }