package sshtun import ( "bufio" "go.uber.org/zap" "golang.org/x/crypto/ssh" ) func StdoutPrinterSessionCallback(log *zap.SugaredLogger) SessionCallback { return func(session *ssh.Session) { stdout, err := session.StdoutPipe() if err != nil { return } scan := bufio.NewScanner(stdout) for scan.Scan() { log.Debug(scan.Text()) } } }