Documentation
¶
Index ¶
Constants ¶
View Source
const LevelFatal = slog.Level(12)
LevelFatal is a custom slog.Level that maps to sentry.LevelFatal.
View Source
const SlogOrigin = "auto.log.slog"
Variables ¶
View Source
var ( // Deprecated: LogLevels is only used by the deprecated event capture functionality. // Will be removed in 0.48.0. LogLevels = map[slog.Level]sentry.Level{ slog.LevelDebug: sentry.LevelDebug, slog.LevelInfo: sentry.LevelInfo, slog.LevelWarn: sentry.LevelWarning, slog.LevelError: sentry.LevelError, LevelFatal: sentry.LevelFatal, } )
Functions ¶
func DefaultConverter
deprecated
func DefaultConverter(addSource bool, replaceAttr func(groups []string, a slog.Attr) slog.Attr, loggerAttr []slog.Attr, groups []string, record *slog.Record, hub *sentry.Hub) *sentry.Event
Deprecated: DefaultConverter is only used by the deprecated event capture functionality. Errors should only be captured using sentry.CaptureException instead of being converted from log entries. Will be removed in 0.48.0.
Types ¶
type Converter
deprecated
type Converter func(addSource bool, replaceAttr func(groups []string, a slog.Attr) slog.Attr, loggerAttr []slog.Attr, groups []string, record *slog.Record, hub *sentry.Hub) *sentry.Event
Deprecated: Converter is only used by the deprecated event capture functionality. Errors should only be captured using sentry.CaptureException instead of being converted from log entries. Will be removed in 0.48.0.
type Option ¶
type Option struct {
// Deprecated: Use EventLevel instead. Level is kept for backwards compatibility and defaults to EventLevel.
Level slog.Leveler
// Deprecated: EventLevel creates issues/events from log entries. Errors should only be
// captured using sentry.CaptureException instead of being converted from log entries.
// Use LogLevel for structured logging. Will be removed in 0.48.0.
EventLevel []slog.Level
// LogLevel specifies the exact log levels to capture and send to Sentry as Log entries.
// Only logs at these specific levels will be processed as log entries.
// Defaults to []slog.Level{slog.LevelDebug, slog.LevelInfo, slog.LevelWarn, slog.LevelError, LevelFatal}.
LogLevel []slog.Level
// Deprecated: Hub is only used by the deprecated event capture functionality. Errors
// should only be captured using sentry.CaptureException instead of being converted
// from log entries. Will be removed in 0.48.0.
Hub *sentry.Hub
// Deprecated: Converter is only used by the deprecated event capture functionality.
// Errors should only be captured using sentry.CaptureException instead of being
// converted from log entries. Will be removed in 0.48.0.
Converter Converter
// AttrFromContext is an optional slice of functions that extract attributes
// from the context. These functions can add additional metadata to the log entry.
AttrFromContext []func(ctx context.Context) []slog.Attr
// AddSource is an optional flag that, when set to true, includes the source
// information (such as file and line number) in the Sentry event.
// This can be useful for debugging purposes.
AddSource bool
// ReplaceAttr is an optional function that allows for the modification or
// replacement of attributes in the log record. This can be used to filter
// or transform attributes before they are sent to Sentry.
ReplaceAttr func(groups []string, a slog.Attr) slog.Attr
}
Click to show internal directories.
Click to hide internal directories.