Skip to content

Commit 22939f7

Browse files
committed
Don't send logs if there are no metrics
1 parent ce97369 commit 22939f7

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

emf/logger_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"github.com/kinbiko/jsonassert"
66
"github.com/prozz/aws-embedded-metrics-golang/emf"
7-
"github.com/tj/assert"
87
"io/ioutil"
98
"os"
109
"testing"
@@ -199,7 +198,9 @@ func TestEmf(t *testing.T) {
199198
logger := emf.NewFor(&buf)
200199
logger.Log()
201200

202-
assert.Empty(t, buf.String())
201+
if buf.String() != "" {
202+
t.Error("Buffer not empty")
203+
}
203204
})
204205

205206
t.Run("new context, no metrics set", func(t *testing.T) {
@@ -208,7 +209,9 @@ func TestEmf(t *testing.T) {
208209
logger.NewContext().Namespace("galaxy")
209210
logger.Log()
210211

211-
assert.Empty(t, buf.String())
212+
if buf.String() != "" {
213+
t.Error("Buffer not empty")
214+
}
212215
})
213216
}
214217

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ go 1.14
44

55
require (
66
github.com/kinbiko/jsonassert v1.0.1
7-
github.com/tj/assert v0.0.3
87
)

go.sum

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
1-
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2-
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1+
github.com/kinbiko/jsonassert v1.0.1 h1:8gdLmUaPWuxk2TzQSofKRqatFH6zwTF6AsUH4bugJYY=
32
github.com/kinbiko/jsonassert v1.0.1/go.mod h1:QRwBwiAsrcJpjw+L+Q4WS8psLxuUY+HylVZS/4j74TM=
4-
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
5-
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
6-
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
7-
github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk=
8-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
9-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
10-
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)