Documentation
¶
Index ¶
- Constants
- type Handler
- func (h *Handler) Enabled(_ context.Context, level slog.Level) bool
- func (h *Handler) Flush(timeout time.Duration) bool
- func (h *Handler) Handle(_ context.Context, r slog.Record) error
- func (h *Handler) ReplaceAttr(fn func(groups []string, a slog.Attr) slog.Attr)
- func (h *Handler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *Handler) WithGroup(name string) slog.Handler
Constants ¶
const ( FieldError = "error" FieldRequest = "request" FieldEnvironment = "env" FieldBuildInfo = "build" )
Common log fields.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is a log/slog.Handler for Sentry.
func NewFromClient ¶
NewFromClient initializes a new Handler which sends logs to the provided sentry client.
func (*Handler) Enabled ¶
Enabled returns true if level is at least to the configured minimum level.
func (*Handler) Flush ¶
Flush waits until the underlying Sentry transport sends any buffered events, blocking for at most the given timeout. It returns false if the timeout was reached, in which case some events may not have been sent.
func (*Handler) ReplaceAttr ¶ added in v0.2.0
ReplaceAttr can be used to change the default keys of the built-in attributes, convert types (for example, to replace a `time.Time` with the integer seconds since the Unix epoch), sanitize personal information, or remove attributes from the output.