code: func (o *ioOutput) Write(ld *LineData) error {
  	size := o.initialSize + len(ld.Message) + 1
  	buffer := bytes.NewBuffer(make([]byte, 0, size))
  
  	// Walk the formatting functions calling them so they can write to the output
  	// buffer where possible.
  	for _, f := range o.formatFuncs {
  		if err := f(ld, buffer); err != nil {
  			return err
  		}
  	}
  
  	// Return the bytes that we generated in the functions above.
  	data := buffer.Bytes()
  	if len(data) == 0 || data[len(data)-1] != '\n' {
  		if err := buffer.WriteByte('\n'); err != nil {
  			return err
  		}
  	}
  
  	// Write the data in the buffer to the output writer.
  	if _, err := o.writer.Write(buffer.Bytes()); err != nil {
  		return err
  	}
  	return nil
  }
docs: // Write attempts to add a line to this output object. This may be buffered, or
  // unbuffered so its not safe to assume that this call will not block.