github.com/mongodb/grip@v0.0.0-20240213223901-f906268d82b9/send/annotating_test.go (about) 1 package send 2 3 import ( 4 "testing" 5 6 "github.com/mongodb/grip/level" 7 "github.com/mongodb/grip/message" 8 "github.com/stretchr/testify/assert" 9 "github.com/stretchr/testify/require" 10 ) 11 12 func TestAnnotatingSender(t *testing.T) { 13 insend, err := NewInternalLogger("annotatingSender", LevelInfo{Threshold: level.Debug, Default: level.Debug}) 14 require.NoError(t, err) 15 16 annotate := NewAnnotatingSender(insend, map[string]interface{}{"a": "b"}) 17 18 annotate.Send(message.NewSimpleFields(level.Notice, message.Fields{"b": "a"})) 19 msg, ok := insend.GetMessageSafe() 20 require.True(t, ok) 21 assert.Contains(t, msg.Rendered, "a='b'") 22 assert.Contains(t, msg.Rendered, "b='a'") 23 24 }