file

package
v2.5.2 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatText = internal.FormatText // 文本格式
	FormatJson = internal.FormatJson // JSON格式
)
View Source
const Name = "file"

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

type Format = internal.Format

Format 日志输出格式

type Option

type Option func(o *options)

func WithCompress

func WithCompress(compress bool) Option

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

func WithFormat

func WithFormat(format Format) Option

WithFormat 设置输出格式

func WithMaxAge

func WithMaxAge(maxAge time.Duration) Option

WithMaxAge 设置文件最大留存时间

func WithMaxSize

func WithMaxSize(maxSize int64) Option

WithMaxSize 设置单个文件最大尺寸

func WithPath

func WithPath(path string) Option

WithPath 设置文件路径

func WithRotate

func WithRotate(rotate Rotate) Option

WithRotate 设置文件反转规则

type Rotate

type Rotate string

日志翻转规则

const (
	RotateNone  Rotate = "none"  // 不翻转
	RotateYear  Rotate = "year"  // 按年翻转
	RotateMonth Rotate = "month" // 按月翻转
	RotateWeek  Rotate = "week"  // 按周翻转
	RotateDay   Rotate = "day"   // 按天翻转
	RotateHour  Rotate = "hour"  // 按时翻转
)

type Syncer

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

func NewSyncer

func NewSyncer(opts ...Option) *Syncer

func (*Syncer) Close

func (s *Syncer) Close() error

Close 关闭同步器

func (*Syncer) Name

func (s *Syncer) Name() string

Name 同步器名称

func (*Syncer) Write

func (s *Syncer) Write(entity *internal.Entity) error

Write 写入日志

Jump to

Keyboard shortcuts

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