github.com/binbinly/pkg@v0.0.11-0.20240321014439-f4fbf666eb0f/logger/logger_test.go (about)

     1  package logger
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestLogger(t *testing.T) {
     8  	InitLogger(WithLevel(InfoLevel), WithLogDir("../test/logs/"))
     9  	Log(InfoLevel, "test info")
    10  	Logf(InfoLevel, "test info %d", 1)
    11  
    12  	Fields(map[string]any{"name": "app"}).Log(ErrorLevel, "test error")
    13  	Fields(map[string]any{"name": "app"}).Logf(ErrorLevel, "test error %d", 1)
    14  
    15  	Debug("test debug")
    16  
    17  	Infof("test info")
    18  	Debugf("test debug %d", 1)
    19  }