code: func (s *Stream) Tail(ctx context.Context, params ...TailParam) (*logpb.LogEntry, error) {
  	p := tailParamsInst{
  		r: logdog.TailRequest{
  			Project: string(s.project),
  			Path:    string(s.path),
  		},
  	}
  	for _, param := range params {
  		param.applyTail(&p)
  	}
  
  	resp, err := s.c.C.Tail(ctx, &p.r)
  	if err != nil {
  		return nil, normalizeError(err)
  	}
  	if err := loadStatePointer(p.stateP, resp); err != nil {
  		return nil, err
  	}
  
  	switch len(resp.Logs) {
  	case 0:
  		return nil, nil
  
  	case 1:
  		le := resp.Logs[0]
  		if p.complete {
  			if dg := le.GetDatagram(); dg != nil && dg.Partial != nil {
  				// This is a partial; datagram. Fetch and assemble the full datagram.
  				return s.fetchFullDatagram(ctx, le, true)
  			}
  		}
  		return le, nil
  
  	default:
  		return nil, fmt.Errorf("tail call returned %d logs", len(resp.Logs))
  	}
  }
docs: // Tail performs a tail call, returning the last log entry in the stream. If
  // stateP is not nil, the stream's state will be requested and loaded into the
  // variable.