Skip to content

Instantly share code, notes, and snippets.

@VojtechVitek
Last active February 10, 2023 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VojtechVitek/27319c6c0a098bbaea3a0e6e043d8874 to your computer and use it in GitHub Desktop.
Save VojtechVitek/27319c6c0a098bbaea3a0e6e043d8874 to your computer and use it in GitHub Desktop.
Open-Telemetry (otel) errors to zerolog logger
package main
import (
"github.com/rs/zerolog/log"
"go.opentelemetry.io/otel"
)
func main() {
otel.SetErrorHandler(&otelErrorHandler{})
}
type otelErrorHandler struct{}
func (h *otelErrorHandler) Handle(err error) {
log.Error().Str("component", "otel").Err(err).Send()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment