When software changes business records on someone's behalf, the first bug report is usually "who changed this, and why?" If you cannot answer in under a minute, the system is hard to trust. This post is a short audit-trail checklist for developers building features that edit orders, customers or invoices.
1. Record the actor, not just the action
Store who or what made the change: a staff user, an API key, a scheduled job or an automated assistant. "Updated by system" is not enough. Keep the identity of the person who set the automation up as well.
2. Store before and after values
A log line that says "price changed" is a rumor. A log entry with the old value, the new value and the field name is evidence. Keep it small: only the fields that changed.
3. Keep the reason
Where a change comes from an instruction, such as a form, a message or a rule, save a reference to that instruction. When something looks wrong, you can read what was asked instead of guessing.
4.…