Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Burial 100122 Correct log level for FormSubmissionAttempt Status Change #20143

Merged
merged 6 commits into from
Jan 14, 2025
16 changes: 10 additions & 6 deletions app/models/form_submission_attempt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ def self.latest_attempts
end
end

# rubocop:disable Metrics/MethodLength
wayne-weibel marked this conversation as resolved.
Show resolved Hide resolved
def log_status_change
log_level = :info
log_hash = {
form_submission_id:,
benefits_intake_uuid:,
Expand All @@ -82,19 +84,21 @@ def log_status_change
}

case aasm.current_event
when 'fail!'
when :fail!
log_level = :error
log_hash[:message] = 'Form Submission Attempt failed'
Rails.logger.error(log_hash)
when 'vbms!'
log_hash[:message] = 'Form Submission Attempt went to vbms'
when 'manual!'
when :manual!
log_level = :warn
log_hash[:message] = 'Form Submission Attempt is being manually remediated'
when :vbms!
log_hash[:message] = 'Form Submission Attempt went to vbms'
else
log_hash[:message] = 'Form Submission Attempt State change'
end

Rails.logger.info(log_hash) if aasm.current_event != 'fail!'
Rails.logger.public_send(log_level, log_hash)
end
# rubocop:enable Metrics/MethodLength

private

Expand Down
Loading