log

package
v0.0.0-...-707188c Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogger = slog.New(slog.NewTextHandler(os.Stdout, nil))

DefaultLogger is the logger that WebKit uses to log HTTP Requests and info messages throughout the application.

Functions

func Bootstrap

func Bootstrap(prefix string)

Bootstrap creates a new complaint logger and sets the default.

Types

type LocalHandler

type LocalHandler struct {
	// contains filtered or unexported fields
}

LocalHandler is a handler that logs to the console in a human-readable format for local development environments.

func NewLocalHandler

func NewLocalHandler(writer io.Writer, opts *slog.HandlerOptions, prefix string) *LocalHandler

NewLocalHandler returns a new local handler with the given options.

func (*LocalHandler) Enabled

func (h *LocalHandler) Enabled(ctx context.Context, level slog.Level) bool

Enabled returns whether logging is enabled for the given level in the context.

func (*LocalHandler) Handle

func (h *LocalHandler) Handle(ctx context.Context, r slog.Record) error

Handle handles the logging record and formats it.

func (*LocalHandler) WithAttrs

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

WithAttrs returns a new handler with the provided attributes.

func (*LocalHandler) WithGroup

func (h *LocalHandler) WithGroup(name string) slog.Handler

WithGroup returns a new handler with the provided group name.

type SentryEventIdentityModifier

type SentryEventIdentityModifier struct{}

SentryEventIdentityModifier is a sentry event modifier that simply passes through the event.

func (*SentryEventIdentityModifier) ApplyToEvent

func (m *SentryEventIdentityModifier) ApplyToEvent(event *sentry.Event, hint *sentry.EventHint) *sentry.Event

ApplyToEvent simply returns the event (ignoring the hint).

type SentryHook

type SentryHook struct {
	// contains filtered or unexported fields
}

SentryHook implements logrus.Hook to send errors to sentry

func NewSentryHook

func NewSentryHook(client *sentry.Client) SentryHook

NewSentryHook creates a sentry hook for logrus given a sentry client

func (SentryHook) Fire

func (h SentryHook) Fire(e *logrus.Entry) error

Fire is an event handler for logrus. This is a part of logrus.Hook. Taken from: https://github.com/getsentry/sentry-go/issues/43

func (SentryHook) Levels

func (h SentryHook) Levels() []logrus.Level

Levels returns the levels this hook is enabled for. This is a part of logrus.Hook.

Jump to

Keyboard shortcuts

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