zapstd_test.go 601 Bytes
Newer Older
kzkzzzz's avatar
kzkzzzz committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
package logz

import (
	"github.com/go-kratos/kratos/v2/log"
	"go.uber.org/zap"
	"testing"
)

func TestZapStd_Log(t *testing.T) {
	l := NewLogger(DefaultConfig, zap.AddCaller(), zap.AddCallerSkip(1))
	l.Log(log.LevelDebug, "msg", "qwe123")
	l.Log(log.LevelDebug, "msg", "qwe123", "qqq", "fff", "rrr", "rrr666", "rrr", "rrr666", "rrr", "rrr666")
}

func BenchmarkZapStd_Log(b *testing.B) {
	l := NewLogger(DefaultConfig, zap.AddCaller(), zap.AddCallerSkip(1))
	for i := 0; i < b.N; i++ {
		l.Log(log.LevelDebug, "msg", "qwe123", "qqq", "fff", "rrr1", "rrr666", "rrr2", "rrr666", "rrr3", "rrr666")
	}
}