Skip to content

Commit

Permalink
Replace buflogr with funcr
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlias committed May 30, 2023
1 parent 9dedd95 commit cc0e794
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion exporters/zipkin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ require (
github.com/google/go-cmp v0.5.9
github.com/openzipkin/zipkin-go v0.4.1
github.com/stretchr/testify v1.8.3
github.com/tonglil/buflogr v1.0.1
go.opentelemetry.io/otel v1.16.0
go.opentelemetry.io/otel/sdk v1.16.0
go.opentelemetry.io/otel/trace v1.16.0
Expand Down
2 changes: 0 additions & 2 deletions exporters/zipkin/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tonglil/buflogr v1.0.1 h1:WXFZLKxLfqcVSmckwiMCF8jJwjIgmStJmg63YKRF1p0=
github.com/tonglil/buflogr v1.0.1/go.mod h1:yYWwvSpn/3uAaqjf6mJg/XMiAciaR0QcRJH2gJGDxNE=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
Expand Down
9 changes: 6 additions & 3 deletions exporters/zipkin/zipkin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ import (

ottest "go.opentelemetry.io/otel/internal/internaltest"

"github.com/go-logr/logr/funcr"
zkmodel "github.com/openzipkin/zipkin-go/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tonglil/buflogr"

"go.opentelemetry.io/otel/codes"
"go.opentelemetry.io/otel/sdk/resource"
Expand Down Expand Up @@ -372,11 +372,14 @@ func TestLogrFormatting(t *testing.T) {
args := []interface{}{"s", 1}

var buf bytes.Buffer
exp, err := New("", WithLogr(buflogr.NewWithBuffer(&buf)))
l := funcr.New(func(prefix, args string) {
buf.WriteString(fmt.Sprint(prefix, args))
}, funcr.Options{})
exp, err := New("", WithLogr(l))
require.NoError(t, err)
exp.logf(format, args...)

want := "INFO string \"s\", int 1\n"
want := "\"level\"=0 \"msg\"=\"string \\\"s\\\", int 1\""
got := buf.String()
assert.Equal(t, want, got)
}

0 comments on commit cc0e794

Please sign in to comment.