rollwriter

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: GPL-3.0, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncOption

type AsyncOption func(*AsyncOptions)

func WithDropLog

func WithDropLog(b bool) AsyncOption

func WithLogQueueSize

func WithLogQueueSize(n int) AsyncOption

func WithWriteLogInterval

func WithWriteLogInterval(n int) AsyncOption

func WithWriteLogSize

func WithWriteLogSize(n int) AsyncOption

type AsyncOptions

type AsyncOptions struct {
	LogQueueSize int

	WriteLogSize int

	WriteLogInterval int

	DropLog bool
}

type AsyncRollWriter

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

func NewAsyncRollWriter

func NewAsyncRollWriter(logger io.Writer, opt ...AsyncOption) *AsyncRollWriter

NewAsyncRollWriter

func (*AsyncRollWriter) Close

func (w *AsyncRollWriter) Close() error

func (*AsyncRollWriter) Sync

func (w *AsyncRollWriter) Sync() error

func (*AsyncRollWriter) Write

func (w *AsyncRollWriter) Write(data []byte) (int, error)

type Option

type Option func(*Options)

Option 调用参数工具函数

func WithCompress

func WithCompress(b bool) Option

WithCompress set compress or not

func WithMaxAge

func WithMaxAge(n int) Option

WithMaxAge set max save days

func WithMaxBackups

func WithMaxBackups(n int) Option

WithMaxBackups set log save max files

func WithMaxSize

func WithMaxSize(n int) Option

WithMaxSize set max save size(MB)

func WithRotationTime

func WithRotationTime(s string) Option

WithRotationTime set time format(如:%Y%m%d)

type Options

type Options struct {
	MaxSize int64

	MaxBackups int

	MaxAge int

	Compress bool

	TimeFormat string
}

Options RollWriter parameters

type RollWriter

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

func NewRollWriter

func NewRollWriter(filePath string, opt ...Option) (*RollWriter, error)

func (*RollWriter) Close

func (w *RollWriter) Close() error

func (*RollWriter) Write

func (w *RollWriter) Write(v []byte) (n int, err error)

Jump to

Keyboard shortcuts

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