Help us shape the future of Go! Take the 2026 Go Developer Survey

logfile

package
v1.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMaxBytes 将单个日志控制在 10 MiB,兼顾日常排障和轮转频率。
	DefaultMaxBytes int64 = 10 << 20
	// DefaultMaxFiles 包含当前日志和编号备份,总占用约不超过 50 MiB。
	DefaultMaxFiles = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

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

Writer 按文件大小轮转日志;当前文件使用原路径,历史文件依次为 .1 到 .(maxFiles-1)。

func Open

func Open(path string, maxBytes int64, maxFiles int) (*Writer, error)

func OpenDefault

func OpenDefault(path string) (*Writer, error)

func (*Writer) Close

func (writer *Writer) Close() error

func (*Writer) Write

func (writer *Writer) Write(data []byte) (int, error)

Jump to

Keyboard shortcuts

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