loginterceptor

package
v2.0.0-alpha.68 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PrefixInterceptor

type PrefixInterceptor struct {

	// TargetDelivered receives a single value when the target goroutine
	// finishes processing all messages. Callers should consume from this
	// channel to avoid goroutine leaks, or use Close() and ignore it.
	TargetDelivered <-chan struct{}
	// InterceptedDelivered receives a single value when the intercepted goroutine
	// finishes processing all messages. Callers should consume from this
	// channel to avoid goroutine leaks, or use Close() and ignore it.
	InterceptedDelivered <-chan struct{}
	// contains filtered or unexported fields
}

PrefixInterceptor intercept writes: if a line begins with prefix, it will be written to both writers. Partial writes without newline are buffered until a newline.

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

func NewPrefixInterceptor

func NewPrefixInterceptor(prefixRegexp *regexp.Regexp, intercepted, target io.Writer, logger log.Logger) *PrefixInterceptor

NewPrefixInterceptor returns an io.WriteCloser. Writes are based on line prefix.

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

func (*PrefixInterceptor) Close

func (i *PrefixInterceptor) Close() error

Close stops the interceptor and closes the pipe.

func (*PrefixInterceptor) Write

func (i *PrefixInterceptor) Write(p []byte) (int, error)

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

Jump to

Keyboard shortcuts

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