code: func (r *runner) hookStdoutStderr(ctx context.Context, logdogServ *logdogServer, stdout, stderr io.ReadCloser, streamNamePrefix string) error {
  	tsNow, err := ptypes.TimestampProto(clock.Now(ctx))
  	if err != nil {
  		return err
  	}
  
  	hook := func(rc io.ReadCloser, name string, tee streamproto.TeeType) error {
  		return logdogServ.AddStream(rc, &streamproto.Properties{
  			LogStreamDescriptor: &logpb.LogStreamDescriptor{
  				Name:        path.Join(streamNamePrefix, name),
  				ContentType: "text/plain",
  				Timestamp:   tsNow,
  			},
  			Tee: tee,
  		})
  	}
  
  	if err := hook(stdout, "stdout", streamproto.TeeStdout); err != nil {
  		return err
  	}
  	if err := hook(stderr, "stderr", streamproto.TeeStderr); err != nil {
  		return err
  	}
  	return nil
  }
docs: // hookStdoutStderr sends stdout/stderr to logdogServ and also tees to the
  // current process's stdout/stderr respectively.