# server.ServerOptions.onInvocation

- **Module:** server
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** property
- **Source:** https://github.com/libtmux/libtmux-ts/blob/073b9d7dedad900bff6f5ec0ea47794e40225870/packages/libtmux/src/server.ts#L196
- **Page:** https://libtmux.org/en/ts/latest/reference/server-serveroptions-oninvocation/

Called once per tmux invocation, after it answers or fails.

The seam for logs, traces and metrics. Every command this server runs
reports here, a custom engine's included, and an observer cannot change
what a command does — see [`TmuxInvocationObserver`](/en/ts/latest/reference/common-tmuxinvocationobserver/).

## Examples

```ts
const traced = new Server({
  onInvocation: (report) => {
    console.log(report.commands[0]?.[0], report.durationMs, report.delivery);
  },
});
```
