loginterceptor

package
v2.0.0-alpha.67 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 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 NonBlockingWriter

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

NonBlockingWriter is an io.Writer that writes to a wrapped io.Writer in a non-blocking way.

func NewNonBlockingWriter

func NewNonBlockingWriter(w io.Writer, logger log.Logger) *NonBlockingWriter

NewNonBlockingWriter creates a new NonBlockingWriter.

func (*NonBlockingWriter) Close

func (i *NonBlockingWriter) Close() error

Close stops the interceptor and closes the pipe.

func (*NonBlockingWriter) Run

func (i *NonBlockingWriter) Run()

Run consumes the channel and writes to the wrapped writer.

func (*NonBlockingWriter) Write

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

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

type PrefixInterceptor

type PrefixInterceptor 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.

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.

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