logger_test.go 418 B

123456789101112131415161718192021
  1. package mhayaLogger
  2. import (
  3. "testing"
  4. ctime "github.com/mhaya/extend/time"
  5. )
  6. func BenchmarkWrite(b *testing.B) {
  7. config := defaultConsoleConfig()
  8. config.EnableConsole = false
  9. config.EnableWriteFile = true
  10. config.FileLinkPath = "logs/log1.log"
  11. config.FilePathFormat = "logs/log1_%Y%m%d%H%M.log"
  12. log1 := NewConfigLogger(config)
  13. for i := 0; i < b.N; i++ {
  14. log1.Debug(ctime.Now().ToDateTimeFormat())
  15. }
  16. }