maskingwriter

package module
v0.0.0-...-76a14f8 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: MIT Imports: 5 Imported by: 0

README

masking-writer-go

Thread-safe writer for masking the defined set of strings

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

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

Writer implements writer, that will proxy to specified `backend` writer only complete lines, e.g. that ends in newline. This writer is thread-safe.

func New

func New(
	writer io.WriteCloser,
	lock sync.Locker,
	ensureNewline bool,
	masking []string,
) *Writer

New returns new Writer, that will proxy data to the `backend` writer, thread-safety is guaranteed via `lock`. Optionally, writer can ensure, that last line of output ends with newline, if `ensureNewline` is true.

func (*Writer) Close

func (writer *Writer) Close() error

Close flushes all remaining data and closes underlying backend writer. If `ensureNewLine` was specified and remaining data does not ends with newline, then newline will be added.

Signature matches with io.WriteCloser's Close().

func (*Writer) Write

func (writer *Writer) Write(data []byte) (int, error)

Writer writes data into Writer.

Signature matches with io.Writer's Write().

Jump to

Keyboard shortcuts

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