Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: func(slog.Attr) bool value in argument to record.Attrs #1

Closed
mariocoski opened this issue Apr 23, 2023 · 1 comment
Closed

bug: func(slog.Attr) bool value in argument to record.Attrs #1

mariocoski opened this issue Apr 23, 2023 · 1 comment

Comments

@mariocoski
Copy link

Hello Samber!

Thank you for your package, great docs!

I was wondering whether there is a bug in the converter.go as per:
/go/pkg/mod/github.com/samber/slog-sentry@v0.1.1/converter.go:28:15: cannot use func(attr slog.Attr) {…} (value of type func(attr slog.Attr)) as func(slog.Attr) bool value in argument to record.Attrs

To reproduce

func main() {
	err := sentry.Init(sentry.ClientOptions{
		Dsn: "my dsn",
		// Debug: true,
		// Set TracesSampleRate to 1.0 to capture 100%
		// of transactions for performance monitoring.
		// We recommend adjusting this value in production,
		TracesSampleRate: 1.0,
	})
	if err != nil {
		log.Fatal(fmt.Sprintf("cannot initialise sentry %s", err))
	}

	handler := slogsentry.Option(slogsentry.Option{Level: slog.LevelInfo}).NewSentryHandler()

	logger := slog.New(handler)
	logger = logger.
		With("environment", "dev").
		With("release", "v1.0.0")

	slog.SetDefault(logger)

	slog.Error("slog error", "key", "value")
}

OS: MacOs 11.7.3
GO version: go version go1.20.3 darwin/amd64

Any thoughts?
Thank you!

@mariocoski mariocoski changed the title func(slog.Attr) bool value in argument to record.Attrs bug: func(slog.Attr) bool value in argument to record.Attrs Apr 23, 2023
@samber
Copy link
Owner

samber commented Apr 25, 2023

Thanks for the report.

I was coding with a (not so) outdated version of golang.org/x/exp (late March 😆).

See golang/go#59060

@samber samber closed this as completed Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants