Documentation
¶
Index ¶
Constants ¶
View Source
const ( DatadogHostUS = "datadoghq.com" DatadogHostUS3 = "us3.datadoghq.com" DatadogHostUS5 = "us5.datadoghq.com" DatadogHostEU = "datadoghq.eu" DatadogHostUSGOV = "ddog-gov.com" )
Variables ¶
View Source
var ErrorKeys = []string{"error", "err"}
View Source
var SourceKey = "source"
Functions ¶
Types ¶
type DatadogHandler ¶
type DatadogHandler struct {
// contains filtered or unexported fields
}
type Option ¶
type Option struct {
// log level (default: debug)
Level slog.Leveler
// datadog endpoint
Client *datadog.APIClient
Context context.Context
Timeout time.Duration // default: 10s
// source parameters
Service string
// source (optional): Allows overriding the `source` field sent to DD. defaulted to version.name
Source string
Hostname string
GlobalTags map[string]string
// optional: customize Datadog message builder
Converter Converter
// optional: custom marshaler
Marshaler func(v any) ([]byte, error)
// optional: fetch attributes from context
AttrFromContext []func(ctx context.Context) []slog.Attr
// optional: see slog.HandlerOptions
AddSource bool
ReplaceAttr func(groups []string, a slog.Attr) slog.Attr
}
func (Option) NewDatadogHandler ¶
Click to show internal directories.
Click to hide internal directories.