improve rotation feature for package glog

This commit is contained in:
John
2020-03-26 20:58:57 +08:00
parent 4258a3bbc9
commit ba56eb87b1
6 changed files with 91 additions and 82 deletions

View File

@ -1,20 +1,14 @@
package main
import (
"os"
"time"
"fmt"
"github.com/gogf/gf/os/gfile"
"github.com/gogf/gf/text/gregex"
)
func main() {
file, err := os.Create("/tmp/testfile")
if err != nil {
panic(err)
}
for {
_, err = file.Write([]byte("test\n"))
if err != nil {
panic(err)
}
time.Sleep(5 * time.Second)
}
fmt.Println(gfile.Basename("/tmp/1585227151172826000/access.20200326205231173924.log"))
fmt.Println(
gregex.IsMatchString(`.+\.\d{20}\.log`,
gfile.Basename("/tmp/1585227151172826000/access.20200326205231173924.log")))
}