1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 00:22:41 +08:00
This commit is contained in:
2022-04-22 14:32:29 +08:00
parent efc8210d97
commit f7df1f1668
10 changed files with 276 additions and 82 deletions

44
logx/logrus_test.go Normal file
View File

@ -0,0 +1,44 @@
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")
}
func TestLevel(t *testing.T) {
logger := NewLogrus()
logger.Info("abcd")
// l, _ := ParseLevel("Warn")
// logger.SetLevel(l)
logger.Info("bcdefg")
}
func TestMutiWriter(t *testing.T) {
l := NewLogger().AppendLogger()
_ = l
}