Final cleanup: lazy logfmt build, docstring and example fixes
- transaction.py only builds the logfmt chain when logging is enabled - callbacks.py module docstring documents the logemit special case - docs logemit example uses the settable header instead of a user lookup that would break when logfmt resolution is registered
This commit is contained in:
+3
-3
@@ -269,9 +269,9 @@ def resolve_user_key(value: str) -> str | None:
|
||||
def emit(ev: LogEvent):
|
||||
if ev.kind != "change":
|
||||
return default_emit(ev) # delegate, no chaining needed
|
||||
actor = ev.current.get("users", {}).get(ev.user, {}).get("name", ev.user)
|
||||
line = Line().user(actor, width=20)(" ").action(ev.action)
|
||||
ev.logger.log(ev.level, f"{line}\n" + "\n".join(ev.diff_lines))
|
||||
# Restyle the header; default_emit keeps routing the diff body.
|
||||
ev.header = str(Line().user(ev.user or "-", width=20)(" ").action(ev.action))
|
||||
return True
|
||||
```
|
||||
|
||||
#### Terminal Formatting Helpers
|
||||
|
||||
Reference in New Issue
Block a user