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.
Click to show internal directories.
Click to hide internal directories.