api/api_logging.go
func WriteIndentedN(w io.Writer, b []byte, n int) error {
	s := bufio.NewScanner(bytes.NewReader(b))
	if !s.Scan() {
		return nil
	}
	l := s.Text()
	for {
		for x := 0; x < n; x++ {
			if _, err := fmt.Fprint(w, " "); err != nil {
				return err
			}
		}
		if _, err := fmt.Fprint(w, l); err != nil {
			return err
		}
		if !s.Scan() {
			break
		}
		l = s.Text()
		if _, err := fmt.Fprint(w, "\n"); err != nil {
			return err
		}
	}
	return nil
}
func WriteIndentedN(w io.Writer, b []byte, n int) error {
	s := bufio.NewScanner(bytes.NewReader(b))
	if !s.Scan() {
		return nil
	}
	l := s.Text()
	for {
		for x := 0; x < n; x++ {
			if _, err := fmt.Fprint(w, " "); err != nil {
				return err
			}
		}
		if _, err := fmt.Fprint(w, l); err != nil {
			return err
		}
		if !s.Scan() {
			break
		}
		l = s.Text()
		if _, err := fmt.Fprint(w, "\n"); err != nil {
			return err
		}
	}
	return nil
}
func WriteIndentedN ( w io . Writer , b [ ] byte , n int ) error { s := bufio . NewScanner ( bytes . NewReader ( b ) ) if ! s . Scan ( ) { return nil } l := s . Text ( ) for { for x := 0 ; x < n ; x ++ { if _ , err := fmt . Fprint ( w , " " ) ; err != nil { return err } } if _ , err := fmt . Fprint ( w , l ) ; err != nil { return err } if ! s . Scan ( ) { break } l = s . Text ( ) if _ , err := fmt . Fprint ( w , " \n " ) ; err != nil { return err } } return nil }
// WriteIndentedN indents all lines n spaces.
WriteIndentedN indents all lines n spaces .