private void LogJobPerfomedOnSchedulerException(BackgroundJob backgroundJob, Exception exception, string schedulerState, string schedulerAdditionalDetail)
        {
            var jobArg = backgroundJob.Job.Args[0];
            var values = jobArg as Dictionary <string, StringBuilder>;

            values.TryGetValue("resourceID", out var resourceId);
            values.TryGetValue("startActivityId", out var startActivityId);
            values.TryGetValue("versionNumber", out var versionNumber);
            values.TryGetValue("currentuserprincipal", out var currentuserprincipal);

            _logger.LogResumedExecution(new Audit
            {
                AuditDate        = DateTime.Now,
                WorkflowID       = resourceId?.ToString(),
                Environment      = string.Empty,
                VersionNumber    = versionNumber?.ToString(),
                NextActivityId   = startActivityId?.ToString(),
                AuditType        = $"LogResumeExecutionState",
                LogLevel         = (Warewolf.Logging.LogLevel)LogLevel.Info,
                ExecutingUser    = currentuserprincipal?.ToString(),
                Exception        = exception,
                Status           = schedulerState,
                AdditionalDetail = schedulerAdditionalDetail
            });
        }
示例#2
0
        private void LogResumption(Dictionary <string, StringBuilder> values)
        {
            values.TryGetValue("resourceID", out StringBuilder workflowId);
            values.TryGetValue("environment", out StringBuilder environment);
            values.TryGetValue("startActivityId", out StringBuilder startActivityId);
            values.TryGetValue("versionNumber", out StringBuilder versionNumber);
            values.TryGetValue("currentuserprincipal", out StringBuilder currentuserprincipal);
            var audit = new Audit
            {
                WorkflowID     = workflowId?.ToString(),
                Environment    = environment?.ToString(),
                VersionNumber  = versionNumber?.ToString(),
                NextActivityId = startActivityId?.ToString(),
                AuditDate      = DateTime.Now,
                AuditType      = "LogResumeExecutionState",
                LogLevel       = LogLevel.Info
            };

            _logger.LogResumedExecution(audit);
        }