logs.go 495 B

1234567891011121314151617181920
  1. package utils
  2. import (
  3. "github.com/beego/beego/v2/core/logs"
  4. "os"
  5. "time"
  6. )
  7. var FileLog *logs.BeeLogger
  8. var BinLog *logs.BeeLogger
  9. func init() {
  10. FileLog = logs.NewLogger(1000000)
  11. FileLog.SetLogger(logs.AdapterFile, `{"filename":"./rdlucklog/hongze_cygxzs.log"}`)
  12. binLogDir := `./binlog`
  13. os.MkdirAll(binLogDir, os.ModePerm)
  14. BinLog = logs.NewLogger(1000000)
  15. BinLog.SetLogger(logs.AdapterMultiFile, `{"filename":"./binlog/binlog.`+time.Now().Format(FormatDate)+`.log","maxdays":30}`)
  16. }