Emit one structured summary line per CLI invocation. Called at the boundary of ``main()`` so each hook / scheduler / manual CLI call leaves exactly one record behind. Per-step logs inside compile / reviewer / scan are intentionally NOT added here — start with the boundary and push i
(
logger, command: str, started: float, *, exit_code: int, **extras,
)
| 1005 | |
| 1006 | |
| 1007 | def _log_command( |
| 1008 | logger, command: str, started: float, *, exit_code: int, **extras, |
| 1009 | ) -> None: |
| 1010 | """Emit one structured summary line per CLI invocation. |
| 1011 | |
| 1012 | Called at the boundary of ``main()`` so each hook / scheduler / manual |
| 1013 | CLI call leaves exactly one record behind. Per-step logs inside compile / |
| 1014 | reviewer / scan are intentionally NOT added here — start with the |
| 1015 | boundary and push inward only if an investigation actually needs it. |
| 1016 | """ |
| 1017 | duration_ms = int((time.monotonic() - started) * 1000) |
| 1018 | logger.info( |
| 1019 | "cli command completed", |
| 1020 | extra={ |
| 1021 | "kind": command or "unknown", |
| 1022 | "exit_code": exit_code, |
| 1023 | "duration_ms": duration_ms, |
| 1024 | **extras, |
| 1025 | }, |
| 1026 | ) |
| 1027 | |
| 1028 | |
| 1029 | if __name__ == "__main__": |