output

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Stdout Type = 1
	Stderr      = 2
	Any         = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferedCollector

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

BufferedCollector collects stdout, stderr, and mixed logs.

func NewBufferedCollector

func NewBufferedCollector(fnd app.Foundation, tid string) *BufferedCollector

NewBufferedCollector initializes and returns a new BufferedCollector.

func (*BufferedCollector) AnyReader

func (bc *BufferedCollector) AnyReader(ctx context.Context) io.Reader

AnyReader returns an io.Reader for the mixed logs in the order they were collected.

func (*BufferedCollector) Close

func (bc *BufferedCollector) Close() error

Close closes all pipes.

func (*BufferedCollector) LogOutput

func (bc *BufferedCollector) LogOutput()

LogOutput logs data of all buffers. It should be used only after closing the collector otherwise races possible.

func (*BufferedCollector) Start

func (bc *BufferedCollector) Start(stdoutPipe, stderrPipe io.ReadCloser) error

Start collects stdout, stderr, and mixed logs from the given command.

func (*BufferedCollector) StderrReader

func (bc *BufferedCollector) StderrReader(ctx context.Context) io.Reader

StderrReader returns an io.Reader for the collected stderr logs.

func (*BufferedCollector) StderrWriter

func (bc *BufferedCollector) StderrWriter() io.Writer

StderrWriter returns a MultiWriter that writes to both stderrBuffer and mixedBuffer

func (*BufferedCollector) StdoutReader

func (bc *BufferedCollector) StdoutReader(ctx context.Context) io.Reader

StdoutReader returns an io.Reader for the collected stdout logs.

func (*BufferedCollector) StdoutWriter

func (bc *BufferedCollector) StdoutWriter() io.Writer

StdoutWriter returns a MultiWriter that writes to both stdoutBuffer and mixedBuffer

func (*BufferedCollector) Wait

func (bc *BufferedCollector) Wait()

Wait blocks until all logs are collected.

type Collector

type Collector interface {
	Close() error
	AnyReader(ctx context.Context) io.Reader
	StderrReader(ctx context.Context) io.Reader
	StdoutReader(ctx context.Context) io.Reader
	Start(stdoutPipe, stderrPipe io.ReadCloser) error
	StdoutWriter() io.Writer
	StderrWriter() io.Writer
	LogOutput()
	Wait()
}

type Maker

type Maker interface {
	MakeCollector(tid string) Collector
}

func CreateMaker

func CreateMaker(fnd app.Foundation) Maker

type Type

type Type int

Jump to

Keyboard shortcuts

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