streamformatter

package
v0.0.0-...-c70285d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package streamformatter provides helper functions to format a stream.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatError

func FormatError(err error) []byte

FormatError formats the error as a JSON object

func FormatStatus

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

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

func NewJSONProgressOutput

func NewJSONProgressOutput(out io.Writer, newLines bool) progress.Output

NewJSONProgressOutput returns a progress.Output that formats output using JSON objects

func NewProgressOutput

func NewProgressOutput(out io.Writer) progress.Output

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

func NewStderrWriter

func NewStderrWriter(out io.Writer) io.Writer

NewStderrWriter returns a writer which formats the output as json message representing stderr lines

func NewStdoutWriter

func NewStdoutWriter(out io.Writer) io.Writer

NewStdoutWriter returns a writer which formats the output as json message representing stdout lines

Types

type AuxFormatter

type AuxFormatter struct {
	io.Writer
}

AuxFormatter is a streamFormatter that writes aux progress messages

func (*AuxFormatter) Emit

func (sf *AuxFormatter) Emit(id string, aux interface{}) error

Emit emits the given interface as an aux progress message

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL