You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
513 B

3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
  1. package main
  2. import (
  3. "git.drinkme.beer/yinghe/log"
  4. "time"
  5. )
  6. func main() {
  7. log.Infof("hahah")
  8. log.ReloadLogger("./conf/cfg.toml")
  9. log.Infof(" reloaded.")
  10. now := time.Now()
  11. log.RotateLogger(log.New(`./logs/cmd.`+now.Format(time.RFC3339), `./logs/cmd`))
  12. log.Info("ping")
  13. log.RotateLogger(log.New(`./logs/cmd.`+now.Format(time.RFC3339), `./logs/cmd`))
  14. log.Infof("pong")
  15. log.RotateLogger(log.New(`./logs/cmd.`+now.Add(time.Hour).Format(time.RFC3339), `./logs/cmd`))
  16. log.Infof("one hour later....")
  17. }