~bigbes/ci-cacher

ref: 35e3d35fa942c39ddf0fcb3306c07458e5920391 ci-cacher/cmd/util.go -rw-r--r-- 416 bytes
35e3d35f — Eugene Blikh Fix Garage compat: PingBucket via ListObjects, fixed config path, delimited list 2 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package cmd

import (
	"fmt"
	"io"
	"os"
)

// newWarnWriter forwards everything written to it to stderr, prefixed
// with a tag. Used to surface docker subcommand stderr in CI logs.
func newWarnWriter(tag string) io.Writer {
	return &warnWriter{tag: tag}
}

type warnWriter struct{ tag string }

func (w *warnWriter) Write(p []byte) (int, error) {
	fmt.Fprintf(os.Stderr, "[%s] %s", w.tag, p)
	return len(p), nil
}