Last active
February 10, 2023 13:18
-
-
Save VojtechVitek/27319c6c0a098bbaea3a0e6e043d8874 to your computer and use it in GitHub Desktop.
Open-Telemetry (otel) errors to zerolog logger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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