logio

package
v2.0.0-alpha.69 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PipeWiring

type PipeWiring struct {
	XcbuildRawout bytes.Buffer
	XcbuildStdout io.Writer
	XcbuildStderr io.Writer
	ToolStdin     io.ReadCloser
	ToolStdout    io.WriteCloser
	ToolStderr    io.WriteCloser
	// contains filtered or unexported fields
}

PipeWiring is a helper struct to define the setup and binding of tools and xcbuild with a filter and stdout. It is purely boilerplate reduction and it is the users responsibility to choose between this and manual hooking of the in/outputs. It also provides a convenient Close() method that only closes things that can/should be closed.

func SetupPipeWiring

func SetupPipeWiring(filter *regexp.Regexp) *PipeWiring

SetupPipeWiring creates a new PipeWiring instance that contains the usual input/outputs that an xcodebuild command and a logging tool needs when we are also using a logging filter.

func (*PipeWiring) Close

func (i *PipeWiring) Close() error

Close closes the PipeWiring instances that needs to be closing as part of this instance.

In reality it can only close the filter and the tool input as everything else is managed by a command or the os.

type PrefixFilter

type PrefixFilter struct {
	Matching *Sink
	Filtered *Sink
	// contains filtered or unexported fields
}

PrefixFilter intercept writes: when the message has a prefix that matches a regexp it writes into the `Matching` sink, otherwise to the `Filtered` sink.

Note: Callers are responsible for closing `Matching` and `Filtered` Sinks

func NewPrefixFilter

func NewPrefixFilter(prefixRegexp *regexp.Regexp, matching, filtered *Sink) *PrefixFilter

NewPrefixFilter returns a new PrefixFilter. Writes are based on line prefix.

Note: Callers are responsible for closing intercepted and target writers that implement io.Closer

func (*PrefixFilter) Close

func (p *PrefixFilter) Close() error

Close stops the interceptor and closes the pipe.

func (*PrefixFilter) Done

func (p *PrefixFilter) Done() <-chan struct{}

Done returns a channel on which the user can observe when the last messages are written to the outputs. The channel has a buffer of one to prevent early unreceived messages or late subscriptions to the channel.

func (*PrefixFilter) MessageLost

func (p *PrefixFilter) MessageLost() <-chan error

MessageLost returns a channel on which the user can observe if there were messages lost. The channel has a buffer of one to prevent early unreceived messages or late subscriptions to the channel.

func (*PrefixFilter) ScannerError

func (p *PrefixFilter) ScannerError() <-chan error

ScannerError returns a channel on which the user can observe if there were any scanner errors. The channel has a buffer of one to prevent early unreceived messages or late subscriptions to the channel.

func (*PrefixFilter) Write

func (p *PrefixFilter) Write(data []byte) (int, error)

Write implements io.Writer. It writes into an internal pipe which the interceptor goroutine consumes.

type Sink

type Sink struct {
	io.WriteCloser
	// contains filtered or unexported fields
}

Sink is an io.WriteCloser that uses a bufio.Writer to wrap the downstream and default buffer sizes and the regular flushing of the buffer for convenience.

func NewSink

func NewSink(downstream io.Writer) *Sink

NewSink creates a new Sink instance

func (*Sink) Close

func (s *Sink) Close() error

Close conformance

func (*Sink) Errors

func (s *Sink) Errors() <-chan error

Errors is a receive only channel where the sink can communicate errors happened on sending, should the user be interested in them

func (*Sink) Write

func (s *Sink) Write(p []byte) (int, error)

Write conformance

Jump to

Keyboard shortcuts

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