github.com/volts-dev/volts@v0.0.0-20240120094013-5e9c65924106/logger/logger_test.go (about) 1 package logger 2 3 import ( 4 "fmt" 5 "testing" 6 ) 7 8 func TestLogger(t *testing.T) { 9 log := New("log") 10 fmt.Println("Strart") 11 12 log.SetLevel(LevelDebug) 13 log.Async() 14 log.EnableFuncCallDepth(true) 15 log.Dbgf("%s", "Test LevelDebug!") 16 log.Errf("%s", "Test LevelDebug!") 17 log.Infof("%s", "Test LevelDebug!") 18 log.Warnf("%s", "Test LevelDebug!") 19 20 log.SetLevel(LevelError) 21 log.Dbgf("%s", "Test LevelError!") 22 log.Errf("%s", "Test LevelError!") 23 log.Infof("%s", "Test LevelError!") 24 log.Warnf("%s", "Test LevelError!") 25 26 log.SetLevel(LevelWarn) 27 log.Dbgf("%s", "Test LevelWarn!") 28 log.Errf("%s", "Test LevelWarn!") 29 log.Infof("%s", "Test LevelWarn!") 30 log.Warnf("%s", "Test LevelWarn!") 31 32 log.SetLevel(LevelInfo) 33 log.Dbgf("%s", "Test logger!") 34 log.Errf("%s", "Test logger!") 35 log.Infof("%s", "Test logger!") 36 log.Warnf("%s", "Test logger!") 37 38 fmt.Println("end") 39 <-make(chan int) 40 }