Skip to content

Commit

Permalink
test: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
davidebianchi committed Sep 7, 2023
1 parent 8d8b6b1 commit 6169bf0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions loggers/logrus/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ func TestLogger(t *testing.T) {
logger.WithFields(expectedFields).Info("my msg")
logger.WithFields(expectedFields).Trace("some other")
logger.WithFields(expectedFields).Info("yeah")
logger.Info("ok")

require.Len(t, hook.AllEntries(), 3)
require.Len(t, hook.AllEntries(), 4)
assertLog(t, hook.AllEntries()[0], expectedLog{
Level: "info",
Message: "my msg",
Expand All @@ -130,11 +131,16 @@ func TestLogger(t *testing.T) {
Message: "some other",
Fields: expectedFields,
})
assertLog(t, hook.LastEntry(), expectedLog{
assertLog(t, hook.AllEntries()[2], expectedLog{
Level: "info",
Message: "yeah",
Fields: expectedFields,
})
assertLog(t, hook.LastEntry(), expectedLog{
Level: "info",
Message: "ok",
Fields: map[string]any{},
})
})
})

Expand Down

0 comments on commit 6169bf0

Please sign in to comment.