bigmachine: Index | Files

package tee

import ""

Package tee implements utilities for I/O multiplexing.


Package Files


type Writer Uses

type Writer sync.Map

Write is an asynchronous write multiplexer. Write maintains a small internal buffer but may discard writes for writers that cannot keep up; thus it is meant for log output or similar.

func (*Writer) Tee Uses

func (w *Writer) Tee(wr io.Writer) (cancel func())

Tee forwards future writes from this writer to wr; forwarding stops after the return cancelation function is invoked. A small buffer is maintained for each writer, but writes are dropped if the writer wr cannot keep up with the write volume. The writer is not forwarded any more writes if returns an error.

func (*Writer) Write Uses

func (w *Writer) Write(p []byte) (n int, err error)

Write writes p to each writer that is managed by this multiplexer. Write is asynchronous, and always returns len(p), nil.

Package tee imports 3 packages (graph) and is imported by 1 packages. Updated 2019-10-02. Refresh now. Tools for package owners.