mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 00:22:41 +08:00
temporary
This commit is contained in:
27
logx/rotate_writer_test.go
Normal file
27
logx/rotate_writer_test.go
Normal file
@ -0,0 +1,27 @@
|
||||
package logx
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
rotatelogs "github.com/lestrrat/go-file-rotatelogs"
|
||||
)
|
||||
|
||||
func TestNewWriter(t *testing.T) {
|
||||
t.Log(filepath.Abs("logs"))
|
||||
|
||||
logf, err := rotatelogs.New("logs/aaaa.%Y%m%d.log",
|
||||
rotatelogs.WithMaxAge(24*time.Hour),
|
||||
rotatelogs.WithRotationTime(time.Hour))
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer logf.Close()
|
||||
|
||||
t.Log(logf.CurrentFileName())
|
||||
|
||||
_, err = logf.Write([]byte("abaccad"))
|
||||
t.Log(err)
|
||||
}
|
Reference in New Issue
Block a user