Skip to content

Commit

Permalink
amelioration(data_fixer/dossier_champs_missing): ajoute du log
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin committed Oct 19, 2023
1 parent 70c5480 commit 0e958ac
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions app/lib/data_fixer/dossier_champs_missing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def apply_fix(dossier)
added_champs = added_champs_root + added_champs_in_repetition
if !added_champs.empty?
dossier.save!
log_champs_added(dossier, added_champs)
added_champs.size
else
0
Expand Down Expand Up @@ -62,4 +63,19 @@ def fix_champs_in_repetition(dossier)
end
end
end

def log_champs_added(dossier, added_champs)
app_traces = caller.reject { _1.match?(%r{/ruby/.+/gems/}) }.map { _1.sub(Rails.root.to_s, "") }

payload = {
message: "DataFixer::DossierChampsMissing",
dossier_id: dossier.id,
champs_ids: added_champs.map(&:id).join(",")
caller: log_champs_added
}

logger = Lograge.logger || Rails.logger

logger.info payload.to_json
end
end

0 comments on commit 0e958ac

Please sign in to comment.