Documentation ¶
Overview ¶
该组件可以与任何可以写入io.Writer的日志包进行配合(包括标准库的log包) 主要特性: 1. 支持日志按文件大小进行滚动 2. 支持日志按时间进行滚动 3. 支持自动清理过期或者多余的日志文件 4. 支持压缩日志文件
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 AsyncRollWriter ¶
type AsyncRollWriter struct {
// contains filtered or unexported fields
}
func NewAsyncRollWriter ¶
func NewAsyncRollWriter(logger io.Writer, opt ...AsyncOption) *AsyncRollWriter
NewAsyncRollWriter 根据传入的参数创建一个RollWriter对
func (*AsyncRollWriter) Close ¶
func (w *AsyncRollWriter) Close() error
func (*AsyncRollWriter) Sync ¶
func (w *AsyncRollWriter) Sync() error
type Option ¶
type Option func(*Options)
Option 调用参数工具函数
func WithCompress ¶
func WithRotationTime ¶
type Options ¶
type Options struct { // MaxSize 日志文件最大大小(字节) MaxSize int64 // MaxBackups 保留的日志最大文件数 MaxBackups int // MaxAge 日志最大保留时间(天) MaxAge int // 日志文件是否压缩 Compress bool // TimeFormat 按时间分隔文件的时间格式 TimeFormat string }
Option RollWriter类调用参数
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
Click to show internal directories.
Click to hide internal directories.