rollfile

package module
v0.0.0-...-91e689c Latest Latest
Warning

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

Go to latest
Published: May 7, 2019 License: MIT Imports: 10 Imported by: 0

README

rollfile

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckRollFile

func CheckRollFile(fname string, tlayout string, ut time.Time) bool

检查文件信息,根据最后一次写时间,判断是否需要更换时间. 如果文件为大小为0,则不会更换.

func CompressFile

func CompressFile(oldfile string, gzfname string, fmode os.FileMode) (err error)

func CreateDir

func CreateDir(path string, fmode os.FileMode) (err error)

func GetCTime

func GetCTime(finfo os.FileInfo) time.Time

func OpenFile

func OpenFile(fname string, fmode os.FileMode) (f *os.File, err error)

func RemoveFile

func RemoveFile(fname string) (err error)

Types

type RFWrite

type RFWrite struct {
	WriteInfo
	// contains filtered or unexported fields
}

func NewRFWrite

func NewRFWrite(cfg RollCfg) (w *RFWrite, err error)

func (*RFWrite) RollFile

func (w *RFWrite) RollFile(foreopt bool) error

func (*RFWrite) TimeTick

func (w *RFWrite) TimeTick()

func (*RFWrite) Write

func (w *RFWrite) Write(b []byte) (int, error)

func (*RFWrite) WriteString

func (w *RFWrite) WriteString(str string) (int, error)

type RollCfg

type RollCfg struct {
	FileName    string
	TmpPath     string `json:"tmppath"`
	CommitPath  string `json:"commitpath"`
	MaxSize     int
	MaxLine     int
	RollPattern string //yyyymmdd
	Compress    bool
}

type WriteInfo

type WriteInfo struct {
	FName       string
	TmpPath     string
	CommitPath  string
	MaxSizeByte int64
	MaxLine     int
	RollPattern string
	Commpres    bool
}

Jump to

Keyboard shortcuts

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