Make log/logtest more convenient #6341
Labels
area:logs
Part of OpenTelemetry logs
enhancement
New feature or request
pkg:API
Related to an API package
I never personally used
log/logtest
, but now I see that its usage is not user friendly.See example test:
We missed this because we rely too much on testify which does a lot of magic under the hook.
However, we cannot assume that our users use testify.
Using
IgnoreUnexported
,AllowUnexported
seems bad fromgo-cmp
.I think we should refactor to make it easier to use without any libraries and maybe even without
go-cmp
.Instead of
AssertRecordEqual
we should make the types comparable or addEqual
methods if necessary.From https://google.github.io/styleguide/go/best-practices#leave-testing-to-the-test-function:
More: https://go.dev/wiki/TestComments#assert-libraries
I also have discovered that
RecordFactory
is not used anywhere.We should also add some example in https://pkg.go.dev/go.opentelemetry.io/otel/log/logtest.
I want logtest to be easy to use by people who use:
The text was updated successfully, but these errors were encountered: