Include 'by user' in abort messages
The aborted event now carries the transaction user, resolved through the logfmt chain against the pre-transaction state so it matches change headers. Default rendering: '<action> by <user> transaction aborted: <e>'. User resolution factored into _build_logfmt/_resolve_user helpers shared by the change and abort paths.
This commit is contained in:
+4
-2
@@ -234,8 +234,10 @@ def resolve_user_key(value: str) -> str | None:
|
||||
`"migrated"`, `"aborted"`), the preferred `logger` and `level`, and all
|
||||
relevant state: `action`, `user`, `extra`, `error` (for aborted
|
||||
transactions), `diff`, `previous`/`current` state dicts, the built `logfmt`
|
||||
chain, and version info for migration events. Pretty `header` and
|
||||
`diff_lines` are lazy properties, built only if accessed.
|
||||
chain, and version info for migration events. The default `"aborted"`
|
||||
rendering is `<action>[ by <user>] transaction aborted: <error>` with the
|
||||
action and user colored and the user resolved via `logfmt`. Pretty
|
||||
`header` and `diff_lines` are lazy properties, built only if accessed.
|
||||
- `@kanta.logemit` registers a callback receiving the event. The callback
|
||||
decides what is logged and where: it may log one or more messages on
|
||||
`event.logger`, log somewhere else, or nothing at all. A falsy return
|
||||
|
||||
Reference in New Issue
Block a user