tmux.CommandObserver
Go
- Python Unavailable
- Ruby Unavailable
- Lua Unavailable
- TypeScript Unavailable
- Rust Unavailable
- Go
- Java Unavailable
- .NET Unavailable
- C++ Unavailable
- Swift Unavailable
- Module
- tmux
- Package
- github.com/libtmux/libtmux-go/tmux
- Source
- tmux/observer.go
-
CommandObserver receives one
CommandTraceper tmux command aServerand the values derived from it run:server, err := tmux.NewServer(tmux.ServerOptions{ CommandObserver: func(trace tmux.CommandTrace) { slog.Info("tmux", "command", trace.Subcommand, "transport", trace.Transport.String(), "duration", trace.Duration, "exit", trace.ExitCode) }, }) if err != nil { log.Fatal(err) }
It is called synchronously on the goroutine that ran the command, after the command finishes and before its result is returned, so a slow observer slows every command. Operations may invoke it concurrently; synchronize shared state. A nil observer costs nothing, not even the clock reads.
It sees the version probes this package runs on its own behalf, and the identity probe a daemon guard runs to decide whether a failure was a replaced daemon, so one call can produce more than one trace.
0 declared, 0 inherited