abio

package
v0.0.0-...-e027c79 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB int = 1 << (10 * iota)
	MB
	GB
	TB
	PB
)

常量,大小定义

Variables

This section is empty.

Functions

This section is empty.

Types

type IWriter

type IWriter interface {
	AfterShutdown()
	Closed() bool
	Close()
	Flush() (err error)
	Write(p []byte) (n int, err error)
}

IWriter ...

func MustNewIO

func MustNewIO(filePath string, opts ...*Option) IWriter

MustNewIO ...获取一个io对象,一旦出错,将会panic

type Option

type Option struct {
	//文件最大值,超过该值自动备份,备份文件大小略大于该值
	FileMaxSize int
	//保存目录天数
	SaveDays int
	//writer buffer size,内存缓冲区大小
	BufferSize int
	//自动刷新数据到磁盘的周期,默认值为2秒
	AutoFlushPeriod time.Duration
	//检查删除过期文件目录间隔
	AutoDelPeriod time.Duration
}

Option 参数配置

Jump to

Keyboard shortcuts

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