Documentation
¶
Index ¶
- Variables
- func DefaultConverter(addSource bool, replaceAttr func(groups []string, a slog.Attr) slog.Attr, ...) *slack.WebhookMessage
- func WithReplyBroadcast(ctx context.Context) context.Context
- func WithThreadTimestamp(ctx context.Context, ts string) context.Context
- type Converter
- type Option
- type SlackHandler
Constants ¶
This section is empty.
Variables ¶
View Source
var ColorMapping = map[slog.Level]string{ slog.LevelDebug: "#63C5DA", slog.LevelInfo: "#63C5DA", slog.LevelWarn: "#FFA500", slog.LevelError: "#FF0000", }
View Source
var SourceKey = "source"
Functions ¶
func DefaultConverter ¶
func WithReplyBroadcast ¶ added in v2.5.0
broadcast to channel when replies to thread if set
Types ¶
type Option ¶
type Option struct { // log level (default: debug) Level slog.Leveler // slack webhook url WebhookURL string // slack bot token BotToken string // slack channel (default: webhook channel) Channel string // bot username (default: webhook username) Username string // bot emoji (default: webhook emoji) IconEmoji string // bot emoji (default: webhook emoji) IconURL string // API request timeout (default: 10s) Timeout time.Duration // optional: customize Slack message builder Converter Converter // optional: see slog.HandlerOptions AddSource bool ReplaceAttr func(groups []string, a slog.Attr) slog.Attr }
func (Option) NewSlackHandler ¶
Click to show internal directories.
Click to hide internal directories.