package streamformatter

import "github.com/docker/docker/pkg/streamformatter"

Package streamformatter provides helper functions to format a stream.

Index

Types

type StderrFormatter

type StderrFormatter struct {
	io.Writer
	*StreamFormatter
}

StderrFormatter is a streamFormatter that writes to the standard error.

func (*StderrFormatter) Write

func (sf *StderrFormatter) Write(buf []byte) (int, error)

type StdoutFormatter

type StdoutFormatter struct {
	io.Writer
	*StreamFormatter
}

StdoutFormatter is a streamFormatter that writes to the standard output.

func (*StdoutFormatter) Write

func (sf *StdoutFormatter) Write(buf []byte) (int, error)

type StreamFormatter

type StreamFormatter struct {
	// contains filtered or unexported fields
}

StreamFormatter formats a stream, optionally using JSON.

func NewJSONStreamFormatter

func NewJSONStreamFormatter() *StreamFormatter

NewJSONStreamFormatter returns a StreamFormatter configured to stream json

func NewStreamFormatter

func NewStreamFormatter() *StreamFormatter

NewStreamFormatter returns a simple StreamFormatter

func (*StreamFormatter) FormatError

func (sf *StreamFormatter) FormatError(err error) []byte

FormatError formats the specified error.

func (*StreamFormatter) FormatProgress

func (sf *StreamFormatter) FormatProgress(id, action string, progress *jsonmessage.JSONProgress, aux interface{}) []byte

FormatProgress formats the progress information for a specified action.

func (*StreamFormatter) FormatStatus

func (sf *StreamFormatter) FormatStatus(id, format string, a ...interface{}) []byte

FormatStatus formats the specified objects according to the specified format (and id).

func (*StreamFormatter) FormatStream

func (sf *StreamFormatter) FormatStream(str string) []byte

FormatStream formats the specified stream.

func (*StreamFormatter) NewProgressOutput

func (sf *StreamFormatter) NewProgressOutput(out io.Writer, newLines bool) progress.Output

NewProgressOutput returns a progress.Output object that can be passed to progress.NewProgressReader.

Source Files

streamformatter.go

Version
v1.12.2-rc1
Published
Sep 27, 2016
Platform
js/wasm
Imports
5 packages
Last checked
15 minutes ago

Tools for package owners.