Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 431 Bytes

README.md

File metadata and controls

23 lines (17 loc) · 431 Bytes

rotatefile

a simple Go log rotation library

一个简单的 Go 日志轮换库。

Install 安装

go get -u github.com/baagod/rotatefile@main

Example 用例

file, _ := New("logs/day.log", rotatefile.PerMinute)

for i := 0; i < 1000; i++ {
    now := time.Now().Format(time.DateTime)
    _, _ = file.Write([]byte(fmt.Sprintf("%d: %s\n", i, now)))
    fmt.Println(now)
    time.Sleep(time.Second)
}