log

package
v2.2.4 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB
	MB
	GB
	TB
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileRotate

type FileRotate int
const (
	FileRotateNone     FileRotate = iota // 不翻转
	FileRotateByYear                     // 按年翻转
	FileRotateByMonth                    // 按月翻转
	FileRotateByDay                      // 按天翻转
	FileRotateByHour                     // 按时翻转
	FileRotateByMinute                   // 按分翻转
	FileRotateBySecond                   // 按秒翻转
)

type Option

type Option func(o *options)

func WithCompress

func WithCompress(compress bool) Option

WithCompress 设置是否对轮换日志文件进行压缩

func WithFileMaxAge

func WithFileMaxAge(fileMaxAge int64) Option

WithFileMaxAge 设置文件最大留存时间

func WithFileMaxSize

func WithFileMaxSize(fileMaxSize int64) Option

WithFileMaxSize 设置单个文件最大尺寸

func WithFilePath

func WithFilePath(filePath string) Option

WithFilePath 设置文件路径

func WithFileRotate

func WithFileRotate(fileRotate FileRotate) Option

WithFileRotate 设置文件反转规则

func WithTimezone

func WithTimezone(timezone string) Option

WithTimezone 设置日志文件打印时间的时区

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(opts ...Option) *Writer

func (*Writer) Close

func (w *Writer) Close() error

Close 关闭写入器

func (*Writer) Write

func (w *Writer) Write(p []byte) (n int, err error)

写入数据

Jump to

Keyboard shortcuts

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