(t *testing.T)
| 233 | } |
| 234 | |
| 235 | func TestEntryWithIncorrectField(t *testing.T) { |
| 236 | assert := assert.New(t) |
| 237 | |
| 238 | fn := func() {} |
| 239 | |
| 240 | e := Entry{Logger: New()} |
| 241 | eWithFunc := e.WithFields(Fields{"func": fn}) |
| 242 | eWithFuncPtr := e.WithFields(Fields{"funcPtr": &fn}) |
| 243 | |
| 244 | assert.Equal(`can not add field "func"`, eWithFunc.err) |
| 245 | assert.Equal(`can not add field "funcPtr"`, eWithFuncPtr.err) |
| 246 | |
| 247 | eWithFunc = eWithFunc.WithField("not_a_func", "it is a string") |
| 248 | eWithFuncPtr = eWithFuncPtr.WithField("not_a_func", "it is a string") |
| 249 | |
| 250 | assert.Equal(`can not add field "func"`, eWithFunc.err) |
| 251 | assert.Equal(`can not add field "funcPtr"`, eWithFuncPtr.err) |
| 252 | |
| 253 | eWithFunc = eWithFunc.WithTime(time.Now()) |
| 254 | eWithFuncPtr = eWithFuncPtr.WithTime(time.Now()) |
| 255 | |
| 256 | assert.Equal(`can not add field "func"`, eWithFunc.err) |
| 257 | assert.Equal(`can not add field "funcPtr"`, eWithFuncPtr.err) |
| 258 | } |
| 259 | |
| 260 | func TestEntryLogfLevel(t *testing.T) { |
| 261 | logger := New() |
nothing calls this directly
no test coverage detected