mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-17 16:12:42 +08:00
42 lines
841 B
Go
42 lines
841 B
Go
package logx
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func TestLogrusInfo(t *testing.T) {
|
|
l := NewLogrus()
|
|
l.Info("abcdef")
|
|
}
|
|
|
|
func TestWithField(t *testing.T) {
|
|
var l Logger = NewLogrus(WithFormatter(NewNestedFormatter(NestedFormatterOption{Color: false})))
|
|
|
|
l.WithField("aaa", "aaa").Info("aaaa")
|
|
l.WithField("bbb", "bbb").Info("bbbb")
|
|
|
|
l = l.WithField("111", "111")
|
|
l.WithField("222", "222").Info("222")
|
|
}
|
|
|
|
func TestLogrus(t *testing.T) {
|
|
l := logrus.NewEntry(logrus.New())
|
|
l.WithField("abc", "bcd").Info("aaaa")
|
|
l.WithField("bbb", "bbb").Info("bbbb")
|
|
l.WithField("ccc", "ccc").Info("cccc")
|
|
|
|
l = l.WithField("o", "o")
|
|
l.WithField("z", "z").Info("abcd")
|
|
}
|
|
|
|
func TestLevel(t *testing.T) {
|
|
logger := NewLogrus()
|
|
logger.Info("abcd")
|
|
|
|
// l, _ := ParseLevel("Warn")
|
|
// logger.SetLevel(l)
|
|
logger.Info("bcdefg")
|
|
}
|