streamformatter

package
v20.10.9+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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