ministryofjustice / Claim-for-Crown-Court-Defence

Claim for Crown Court Defence, formerly Advocate Defence Payments (ADP), aka Crime Billing Online (CBO)
MIT License
25 stars 7 forks source link

Refactor clone logging #2184

Closed colinbruce closed 1 year ago

colinbruce commented 6 years ago
def logit error=nil, &block
 LogStuff.send(:info, 'ExternalUsers::ClaimsController',
                   action: 'clone',
                   claim_id: @claim.id,
                   documents: @claim.documents.count,
                   total_size: @claim.documents.sum(:document_file_size)
                   error: error
                  ) do
       yield if block_given?
     end
end

and call...

def clone_rejected
  clone stuff
  logit 'redraft succeeded'
rescue
  logit error.message, 'redraft failed'
end
mpw5 commented 1 year ago

Done in https://github.com/ministryofjustice/Claim-for-Crown-Court-Defence/pull/3905