MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / TestWithField

Function TestWithField

utils/log/logwrapper_test.go:97–158  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

95}
96
97func TestWithField(t *testing.T) {
98 SetLevel(DebugLevel)
99 if GetLevel() != DebugLevel {
100 t.Fail()
101 }
102
103 call0()
104
105 WithError(errors.New("new")).WithField("newfieldkey", "newfieldvalue").WithTime(time.Now()).Debug("debug")
106 f := new(Fields)
107 WithError(errors.New("new")).WithFields(*f).WithTime(time.Now()).Debug("debug")
108
109 WithFields(*f).Debug("debug")
110 WithTime(time.Now()).WithError(errors.New("new")).Debug("debug")
111 entry := NewEntry(StandardLogger())
112 entry.WithTime(time.Now()).String()
113 entry.Printf("entry printf %d", 1)
114
115 WithField("k", "v").Debug("debug")
116 WithField("k", "v").Debugln("Debugln")
117 WithField("k", "v").Debugf("debugf %d", 1)
118 WithField("k", "v").Print("Print")
119 WithField("k", "v").Println("Println")
120 WithField("k", "v").Printf("Printf %d", 1)
121 WithField("k", "v").Info("info")
122 WithField("k", "v").Infoln("Infoln")
123 WithField("k", "v").Infof("infof %d", 1)
124 WithField("k", "v").Warning("warning")
125 WithField("k", "v").Warningln("Warningln")
126 WithField("k", "v").Warningf("Warningf %d", 1)
127 WithField("k", "v").Warn("warn")
128 WithField("k", "v").Warnln("Warnln")
129 WithField("k", "v").Warnln("Warnln")
130 WithField("k", "v").Warnf("warnf %d", 1)
131 WithField("k", "v").Error("error")
132 WithField("k", "v").Errorln("Errorln")
133 WithField("k", "v").Errorf("errorf %d", 1)
134 defer func() {
135 if r := recover(); r != nil {
136 fmt.Println("Recovered in f", r)
137 }
138 defer func() {
139 if r := recover(); r != nil {
140 fmt.Println("Recovered in f", r)
141 }
142 defer func() {
143 if r := recover(); r != nil {
144 fmt.Println("Recovered in f", r)
145 }
146 n := NilFormatter{}
147 a, b := n.Format(&logrus.Entry{})
148 if a != nil || b != nil {
149 t.Fail()
150 }
151 }()
152 WithField("k", "v").Panicf("panicf %d", 1)
153 }()
154 WithField("k", "v").Panicln("Panicln")

Callers

nothing calls this directly

Calls 15

WithTimeMethod · 0.95
PrintfMethod · 0.95
FormatMethod · 0.95
SetLevelFunction · 0.85
GetLevelFunction · 0.85
call0Function · 0.85
WithErrorFunction · 0.85
WithFieldsFunction · 0.85
WithTimeFunction · 0.85
NewEntryFunction · 0.85
StandardLoggerFunction · 0.85
WithFieldFunction · 0.85

Tested by

no test coverage detected