2022-06-24 10:36:15 +08:00
|
|
|
package logutil
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2023-04-06 19:14:32 +08:00
|
|
|
"go.uber.org/zap"
|
2022-06-24 10:36:15 +08:00
|
|
|
"go.uber.org/zap/zapcore"
|
|
|
|
|
2023-04-06 19:14:32 +08:00
|
|
|
"github.com/milvus-io/milvus/pkg/log"
|
2022-06-24 10:36:15 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestName(t *testing.T) {
|
|
|
|
conf := &log.Config{Level: "debug", DisableTimestamp: true}
|
|
|
|
logger, _, _ := log.InitTestLogger(t, conf, zap.AddCallerSkip(1), zap.Hooks(func(entry zapcore.Entry) error {
|
|
|
|
assert.Equal(t, "Testing", entry.Message)
|
|
|
|
return nil
|
|
|
|
}))
|
|
|
|
wrapper := &zapWrapper{logger, 0}
|
|
|
|
|
|
|
|
wrapper.Info("Testing")
|
|
|
|
wrapper.Infoln("Testing")
|
|
|
|
wrapper.Infof("%s", "Testing")
|
|
|
|
wrapper.Warning("Testing")
|
|
|
|
wrapper.Warningln("Testing")
|
|
|
|
wrapper.Warningf("%s", "Testing")
|
|
|
|
wrapper.Error("Testing")
|
|
|
|
wrapper.Errorln("Testing")
|
|
|
|
wrapper.Errorf("%s", "Testing")
|
|
|
|
}
|