slogbreadcrumb

package
v0.0.0-...-425f0b4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

slogbreadcrumb sends everything that's emitted to slog as Sentry breadcrumb, rather than Sentry event (or error). Best used in conjunction with "github.com/samber/slog-multi" package.

Example usage:

package main

import "log/slog"
import slogmulti "github.com/samber/slog-multi"
import slogbreadcrumb "github.com/aldy505/sentry-integration/slogbreadcrumb"

func main() {
	slog.SetDefault(slog.New(slogmulti.Fanout(
		slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{Level: slog.LevelDebug}),
		&slogbreadcrumb.Handler{Enable: true, Level: slog.LevelDebug},
	)))
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	Enable bool
	Level  slog.Level
	// contains filtered or unexported fields
}

func (*Handler) Enabled

func (s *Handler) Enabled(_ context.Context, level slog.Level) bool

func (*Handler) Handle

func (s *Handler) Handle(ctx context.Context, record slog.Record) error

func (*Handler) WithAttrs

func (s *Handler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*Handler) WithGroup

func (s *Handler) WithGroup(name string) slog.Handler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL