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

Support slog logger #26

Open
DAcodedBEAT opened this issue Aug 15, 2024 · 4 comments
Open

Support slog logger #26

DAcodedBEAT opened this issue Aug 15, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@DAcodedBEAT
Copy link

Describe the feature

Add support for the Structured Logging (slog) standard library in Go.

Motivation

Implementing support for slog will align this module with Go's ecosystem standards, enhancing its portability and interoperability.

note: This feature would also allow the module to accommodate other logging requests, as slog's backend interface (Handler) can be adapted to support various popular logging packages. For example, existing integrations include https://github.com/samber/slog-zap and https://github.com/samber/slog-zerolog.

Related Issues

@zstone12
Copy link
Collaborator

The development of this feature is in progress.

@zstone12 zstone12 added the enhancement New feature or request label Dec 11, 2024
@pellared
Copy link

pellared commented Jan 20, 2025

OTel Go maintainer here.

@zstone12, I think you should considering supporting OTel Go Logs API: https://pkg.go.dev/go.opentelemetry.io/otel/log

@DAcodedBEAT
Copy link
Author

@pellared - just for my understanding, why can't the OTel Go Logs API be implemented as a slog Handler and use slog as the common interface?

@pellared
Copy link

pellared commented Jan 23, 2025

@pellared - just for my understanding, why can't the OTel Go Logs API be implemented as a slog Handler and use slog as the common interface?

Take a look at https://github.com/open-telemetry/opentelemetry-go/blob/main/log/DESIGN.md#reuse-slog

Therefore, you can use slog as the interface by using https://pkg.go.dev/go.opentelemetry.io/contrib/bridges/otelslog.
However, it will involve a translation layer.

Given this is an opentelemetry repo I think you can simply integrate using OTel Logs API and not couple to different logging libraries.

PS. Take my words with a grain of salt as I never used nor tried using gorm.io/plugin/opentelemetry.

PPS. Thanks to you I updated the design doc as I was outdated a little: open-telemetry/opentelemetry-go#6206

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants