Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultRotationTime = time.Hour * 24 // 1天 DefaultRotationSize = 50 << 20 // 50M DefaultRotationStorageAge = time.Hour * 24 * 30 // 30天 DefaultRotationCounter = 10086 // 10086个 )
轮转日志参数
Variables ¶
This section is empty.
Functions ¶
func NewRotateFile ¶
func NewRotateFile(cfg *ConfigRotate, configOpts ...Option) (writer io.Writer, err error)
NewRotateFile 轮转输出
Types ¶
type ConfigRotate ¶
type ConfigRotate struct { // 存储位置 // Dir 文件夹 Dir string // Filename 文件名(默认:${filename}_app.%Y%m%d.log) Filename string // RotateTime 轮询规则:n久(默认:86400s # 86400s = 1天) // 轮询规则:默认为:RotateTime RotateTime time.Duration // RotateSize 轮询规则:按文件大小RotateSize(默认:52428800 # 50<<20 = 50M) // 轮询规则:默认为:RotateTime RotateSize int64 // StorageAge 存储规则:n久(默认:30天) // 存储规则:默认为:StorageAge StorageAge time.Duration // StorageCounter 存储规则:n个(默认:10086个) // 存储规则:默认为:StorageAge StorageCounter uint }
ConfigRotate 轮转输出
Click to show internal directories.
Click to hide internal directories.