// MultiLevelWriter creates a writer that duplicates its writes to all the
// provided writers, similar to the Unix tee(1) command. If some writers
// implement LevelWriter, their WriteLevel method will be used instead of Write.
554001
func MultiLevelWriter(writers ...io.Writer) LevelWriter {
	lwriters := make([]LevelWriter, 0, len(writers))
	for _, w := range writers {
		if lw, ok := w.(LevelWriter); ok {
			lwriters = append(lwriters, lw)
		} else {
			lwriters = append(lwriters, levelWriterAdapter{w})
		}
	}
	return multiLevelWriter{lwriters}
}
1151733
func NewIndentWriter(indentLevel uint, indentString string,
	writer io.Writer) *indentWriter {
	return &indentWriter{
		writer:      writer,
		indentLevel: indentLevel,
		indentBytes: []byte(indentString),
		indent:      true,
	}
}
239331
func (c *ConnWriter) WriteMsg(msg string, level int) error {
	if level > c.Level {
		return nil
	}
	if c.neddedConnectOnMsg() {
		err := c.connect()
		if err != nil {
			return err
		}
	}

	if c.ReconnectOnMsg {
		defer c.innerWriter.Close()
	}
	c.lg.Println(msg)
	return nil
}
1327022
func (l *WAL) WriteMulti(values map[string][]Value) (int, error) {
	entry := &WriteWALEntry{
		Values: values,
	}

	id, err := l.writeToLog(entry)
	if err != nil {
		l.tracker.IncWritesErr()
		return -1, err
	}
	l.tracker.IncWritesOK()

	return id, nil
}
773595
func (w *Writer) WriteAll(data [][]string) error {
	err := w.w.WriteAll(data)
	if err != nil {
		return err
	}
	w.r = len(data)
	return nil
}
1085521
func MultiWriteCloser(wc ...io.WriteCloser) io.WriteCloser {
	wcs := make([]io.WriteCloser, len(wc))
	copy(wcs, wc)
	return &mwc{wcs}
}
16842
func (d *DotGit) ShallowWriter() (billy.File, error) {
	return d.fs.Create(shallowPath)
}
1264227
func WriteGoroutineStacks(w io.Writer) error {
	if w == nil {
		return fmt.Errorf("writer nil")
	}
	buf := make([]byte, 1<<20)
	for i := 0; ; i++ {
		n := runtime.Stack(buf, true)
		if n < len(buf) {
			buf = buf[:n]
			break
		}
		if len(buf) >= 32<<20 {
			break
		}
		buf = make([]byte, 2*len(buf))
	}
	_, err := w.Write(buf)
	return err
}
806510
func newWriter(reportFn func(report), layersChangedFn func(report, report) bool) io.WriteCloser {
	writer := &imageProgressWriter{
		mutex:                  &sync.Mutex{},
		layerStatus:            map[string]*progressLine{},
		reportFn:               reportFn,
		layersChangedFn:        layersChangedFn,
		progressTimeThreshhold: defaultProgressTimeThreshhold,
		stableThreshhold:       defaultStableThreshhold,
	}
	return writer
}
169064
func (muf *MutableForest) Writer(prefix []byte) (*RWTree, error) {
	// Try dirty cache first (if tree is new it may only be in this location)
	prefixString := string(prefix)
	if tree, ok := muf.dirty[prefixString]; ok {
		return tree, nil
	}
	tree, err := muf.tree(prefix)
	if err != nil {
		return nil, err
	}
	// Mark tree as dirty
	muf.dirty[prefixString] = tree
	muf.dirtyPrefixes = append(muf.dirtyPrefixes, prefixString)
	return tree, nil
}
1292977
func (opts *Options) SetLevel0SlowdownWritesTrigger(value int) {
	C.rocksdb_options_set_level0_slowdown_writes_trigger(opts.c, C.int(value))
}
278772
func VolumeWrite(ctx Context, volumes []*types.Volume) error {
	render := func(format func(subContext SubContext) error) error {
		for _, volume := range volumes {
			if err := format(&volumeContext{v: *volume}); err != nil {
				return err
			}
		}
		return nil
	}
	return ctx.Write(newVolumeContext(), render)
}
839152
func (f Form) Writer(w io.Writer) io.WriteCloser {
	wr := &normWriter{rb: reorderBuffer{}, w: w}
	wr.rb.init(f, nil)
	return wr
}
1294118
func (sf *StdFormatter) levelHeaders() LevelMap {
	switch {
	case sf.NoColors:
		return sf.HeaderPlain
	case sf.Colors:
		return sf.HeaderColor
	case sf.colorSupported:
		return sf.HeaderColor
	}
	return sf.HeaderPlain
}
307361
func (t TeeType) Writer() io.Writer {
	switch t {
	case TeeNone:
		return nil

	case TeeStdout:
		return os.Stdout

	case TeeStderr:
		return os.Stderr

	default:
		panic(fmt.Errorf("streamproto: unknown tee type [%v]", t))
	}
}
691186
func Writer(outW, errW io.Writer) POption {
	return func(p *POptions) {
		p.outWriter, p.errWriter = outW, errW
	}
}
30048
func NewWriteFlusher(w io.Writer) *WriteFlusher {
	var fl flusher
	if f, ok := w.(flusher); ok {
		fl = f
	} else {
		fl = &NopFlusher{}
	}
	return &WriteFlusher{w: w, flusher: fl, closed: make(chan struct{}), flushed: make(chan struct{})}
}