Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewResource ¶
func NewResource(ctx context.Context, config ResourceConfig) (*sdkresource.Resource, error)
Types ¶
type OtelSlogErrorHandler ¶
type OtelSlogErrorHandler struct {
// contains filtered or unexported fields
}
OtelSlogErrorHandler is a struct representing an OpenTelemetry error handler that uses the slog logging package.
Fields:
- l: A pointer to a slog.Logger instance.
Implemented Interfaces:
- otel.ErrorHandler
Example Usage:
o := OtelSlogErrorHandler{}
func NewOtelSlogErrorHandler ¶
func NewOtelSlogErrorHandler(logger *slog.Logger) OtelSlogErrorHandler
NewOtelSlogErrorHandler creates a new instance of OtelErrorSlogLogger.
Parameters:
- logger: A pointer to a slog.Logger instance.
Returns:
- OtelErrorSlogLogger: The newly created OtelErrorSlogLogger instance.
Example:
logger := slog.New() otelLogger := otel.NewOtelSlogErrorHandler(logger)
func (OtelSlogErrorHandler) Handle ¶
func (o OtelSlogErrorHandler) Handle(err error)
Handle implements otel.ErrorHandler. Logs the error using the slog logging package. It takes an error as a parameter and logs the error message using the slog.Logger instance.
Parameters:
- err: The error to be logged.
Example:
o := OtelErrorSlogLogger{} o.Handle(err)
Click to show internal directories.
Click to hide internal directories.