Briefle words · Code & architecture
Structured logging
Writing log entries as data with named fields, often JSON, instead of free-form sentences, so they can be searched and filtered.
Say it to an AI
TypeScript async syncAccount(accountId) that fetches bank transactions and upserts them. No swallowed exceptions: in the catch, use structured logging with the accountId, set the account's syncStatus to 'failed' so the UI can show it, then rethrow the original error so the job runner can retry and alert. On success set syncStatus back to 'ok'.
How an expert would brief the stronger version of “Bank account sync”.
See it
Try it as a puzzle →A pull request with the job that pulls new transactions from a user's bank into a budgeting app.
Why: A's 'logger.error("Bank sync failed", { accountId, err })' lets support search the logs for one customer's account and see the actual error; B's warning has the account but not what went wrong.
Related words
Room 1 · Essentials
Learn “Structured logging” in a five-minute lesson