spliter

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: MIT Imports: 5 Imported by: 0

README

go-logfile-spliter

A io.Writer to split logger file with cron.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Spliter

type Spliter struct {
	// 文件名生成函数
	FilenameFunc func() string
	// 文件分离失败处理函数
	OnSplitError func(err error)
	// contains filtered or unexported fields
}

func NewSpliter

func NewSpliter(cronString string, FilenameFunc func() string) *Spliter

新建一个Spliter cronString: 见https://pkg.go.dev/github.com/robfig/cron/v3@v3.0.1 filenameFormat

func (*Spliter) SetOnSplitError

func (s *Spliter) SetOnSplitError(fn func(err error))

设置文件分离失败处理函数

func (*Spliter) Split

func (s *Spliter) Split()

文件分离

func (*Spliter) Write

func (s *Spliter) Write(data []byte) (n int, err error)

写文件

Jump to

Keyboard shortcuts

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