code: func (o *pubSubOutput) buildMessage(buf *buffer, bundle *logpb.ButlerLogBundle) (*pubsub.Message, error) {
  	if buf.protoWriter == nil {
  		buf.protoWriter = &butlerproto.Writer{
  			Compress:          o.Compress,
  			CompressThreshold: butlerproto.DefaultCompressThreshold,
  		}
  	}
  
  	// Clear our buffer and (re)initialize our frame writer.
  	buf.Reset()
  	if buf.frameWriter == nil {
  		buf.frameWriter = recordio.NewWriter(buf)
  	} else {
  		buf.frameWriter.Reset(buf)
  	}
  
  	if err := buf.protoWriter.WriteWith(buf.frameWriter, bundle); err != nil {
  		return nil, err
  	}
  
  	return &pubsub.Message{
  		Data: buf.Bytes(),
  	}, nil
  }
docs: // buildMessage constructs a Pub/Sub Message out of LogDog frames.
  //
  // The first frame will be a ButlerMetadata message describing the second
  // frame. The second frame will be a ButlerLogBundle containing the bundle
  // data.