Documentation
¶
Index ¶
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 ¶
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
Timeout time.Duration // default: 10s
// optional: customize Slack message builder
Converter Converter
// optional: see slog.HandlerOptions
AddSource bool
ReplaceAttr func(groups []string, a slog.Attr) slog.Attr
// optional: output to thread
ThreadTimestamp string
BroadcastLevel slog.Leveler
}
func (Option) NewSlackHandler ¶
Click to show internal directories.
Click to hide internal directories.
