writer

package
v0.5.11 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompressOption

type CompressOption func(*CompressWriter)

CompressOption is compress writer option setter function

func CompressionLevel

func CompressionLevel(level int) CompressOption

CompressionLevel set compression level on compress writer

func CompressionType

func CompressionType(t CompressType) CompressOption

CompressionType set compression type on compress writer

type CompressType

type CompressType int

CompressType is the compress writer compression type

const (
	CompressGzip CompressType = iota
	CompressZlib
	CompressNone
)

Compression type allowed

type CompressWriter

type CompressWriter struct {
	io.Writer
	// contains filtered or unexported fields
}

CompressWriter will decorate io.Writer in order to compress the data

func NewCompressWriter

func NewCompressWriter(writer io.Writer, options ...CompressOption) *CompressWriter

NewCompressWriter will return a new compress writer

func (*CompressWriter) Write

func (w *CompressWriter) Write(p []byte) (int, error)

Write will compress data and pass it to the underlying io.Writer

type GelfChunkWriter

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

GelfChunkWriter will decorate io.Writer in order to split the data into chunk

func NewGelfChunkWriter

func NewGelfChunkWriter(writer io.Writer) *GelfChunkWriter

NewGelfChunkWriter will return a new GelfChunkWriter

func (*GelfChunkWriter) Write

func (w *GelfChunkWriter) Write(p []byte) (int, error)

Writer will split the data and pass it to the underlying io.Writer

type Provider

type Provider func(io.Writer) (io.Writer, error)

Provider is an io.Writer provider it is used to get an io.Writer Implementation should manage where and how kind of Writer it will return See provider implementations in the provider package.

type RotateIoWriter

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

RotateIoWriter will rotate the io.writer when rotate is called it delegates the io.writer creation to the Provider

func NewRotateIoWriter

func NewRotateIoWriter(provider Provider) (*RotateIoWriter, error)

NewRotateIoWriter will create a RotateIoWriter create a new io.Writer that can be changed other the time when Rotate() is called

func (*RotateIoWriter) Rotate

func (w *RotateIoWriter) Rotate() (err error)

Rotate will ask the provider to change the underlying io.writer with a new one

func (*RotateIoWriter) Write

func (w *RotateIoWriter) Write(output []byte) (int, error)

Write will pass-through data to the underlying io.writer

type RotateWriter

type RotateWriter interface {
	io.Writer
	Rotate() error
}

RotateWriter is a Writer with extra rotate feature that allows you to change the writer as you need See rotate writer implementations in the writer package.

type TimeRotateWriter

type TimeRotateWriter struct {
	RotateWriter
	Interval     time.Duration
	PanicHandler func(error)
}

TimeRotateWriter will call RotateWriter::Rotate func over the time with the given interval it delegate the io.writer creation to the Provider

func NewTimeRotateFromProvider

func NewTimeRotateFromProvider(provider Provider, interval time.Duration) (*TimeRotateWriter, error)

NewTimeRotateFromProvider will create a TimeRotateFileWriter that rotate an io.writer over the time with the given interval

func NewTimeRotateWriter

func NewTimeRotateWriter(writer RotateWriter, interval time.Duration) *TimeRotateWriter

NewTimeRotateWriter will create a new TimeRotateWriter it will call the given RotateWriter::Rotate func over the time with the given interval

func (*TimeRotateWriter) Start

func (t *TimeRotateWriter) Start()

Start will start listening the interval ticker rotate is gonna be called for each tick of the ticker

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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