日记
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

39 lines
957 B

package log
import (
"context"
"errors"
"git.gz.internal.jumaiyx.cn/pkg/config/v2/cproto"
"git.gz.internal.jumaiyx.cn/pkg/log/klog"
"testing"
"time"
)
func TestLog(t *testing.T) {
klog.NewHelper(klog.DefaultLogger).WithContext(context.Background()).Info("aaa")
}
func TestNewKLogger(t *testing.T) {
ctx := context.Background()
//ctx = context.WithValue(ctx, "reqId", "dadadada")
l := NewLogger(&cproto.Log{
Level: LevelDebug,
//Kafka: &conf.Kafka{
// Addr: []string{"123.207.103.194:9094", "106.55.69.140:9094", "42.194.191.63:9094"},
// //Addr: []string{"175.178.113.184:31090"},
// Topic: "log-information-record-dev",
// Group: "log-information-record-dev",
// Username: "user",
// Password: "Rkyf1Ue9jUI0",
//},
})
//l := DefaultLogger()
l.WithContext(ctx)
//t.Log()
//ll.Ddw()
err := errors.New("err test")
l.Info("44测试test:%v", err)
//l.Errorf("33测试test2:%v", err)
time.Sleep(5 * time.Second)
}