code: func (w *logWriter) write(msg *logMessage) error {
  	if msg.timestamp.Before(w.opts.since) {
  		// Skip the line because it's older than since
  		return nil
  	}
  	line := msg.log
  	if w.opts.timestamp {
  		prefix := append([]byte(msg.timestamp.Format(timeFormat)), delimiter[0])
  		line = append(prefix, line...)
  	}
  	// If the line is longer than the remaining bytes, cut it.
  	if int64(len(line)) > w.remain {
  		line = line[:w.remain]
  	}
  	// Get the proper stream to write to.
  	var stream io.Writer
  	switch msg.stream {
  	case runtimeapi.Stdout:
  		stream = w.stdout
  	case runtimeapi.Stderr:
  		stream = w.stderr
  	default:
  		return fmt.Errorf("unexpected stream type %q", msg.stream)
  	}
  	n, err := stream.Write(line)
  	w.remain -= int64(n)
  	if err != nil {
  		return err
  	}
  	// If the line has not been fully written, return errShortWrite
  	if n < len(line) {
  		return errShortWrite
  	}
  	// If there are no more bytes left, return errMaximumWrite
  	if w.remain <= 0 {
  		return errMaximumWrite
  	}
  	return nil
  }
docs: // writeLogs writes logs into stdout, stderr.