code: func write(prefix string, color *ansi.Color, timestamps bool) func(dest io.Writer, token []byte) (n int, err error) {
  	return func(dest io.Writer, token []byte) (n int, err error) {
  		countingWriter := countingWriter{Writer: dest}
  		if color != nil {
  			ansi.Output = &countingWriter
  			color.Set()
  		}
  		_, err = countingWriter.Write([]byte(prefix))
  		if err == nil {
  			if !timestamps {
  				// timestamps are always present in the incoming stream for
  				// sorting purposes, so we strip them if the user didn't ask
  				// for them
  				const timestampPrefixLength = 31
  				strip := timestampPrefixLength
  				if string(token[0]) == "[" {
  					// it seems that timestamps are wrapped in [] for events
  					// streamed  in real time during a `docker logs -f`
  					strip += 2
  				}
  				token = token[strip:]
  			}
  			_, err = countingWriter.Write(token)
  		}
  		if err == nil {
  			if color != nil {
  				ansi.Unset()
  			}
  			_, err = dest.Write([]byte("\n"))
  		}
  		return countingWriter.written, err
  
  	}
  }
docs: // returns a function that will format and writes the line extracted from the logs of a given container