Documentation ¶
Overview ¶
Package streamformatter provides helper functions to format a stream.
Index ¶
- type StderrFormatter
- type StdoutFormatter
- type StreamFormatter
- func (sf *StreamFormatter) FormatError(err error) []byte
- func (sf *StreamFormatter) FormatProgress(id, action string, progress *jsonmessage.JSONProgress) []byte
- func (sf *StreamFormatter) FormatStatus(id, format string, a ...interface{}) []byte
- func (sf *StreamFormatter) FormatStream(str string) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StderrFormatter ¶ added in v1.9.0
type StderrFormatter struct { io.Writer *StreamFormatter }
StderrFormatter is a streamFormatter that writes to the standard error.
type StdoutFormatter ¶ added in v1.9.0
type StdoutFormatter struct { io.Writer *StreamFormatter }
StdoutFormatter is a streamFormatter that writes to the standard output.
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 specifed error.
func (*StreamFormatter) FormatProgress ¶
func (sf *StreamFormatter) FormatProgress(id, action string, progress *jsonmessage.JSONProgress) []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.