Skip to content

Commit

Permalink
make the log levels customizable
Browse files Browse the repository at this point in the history
  • Loading branch information
samber committed Oct 25, 2023
1 parent 7fcc9b5 commit 03211a4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Other global parameters:

```go
slogslack.SourceKey = "source"
slogslack.ColorMapping = map[slog.Level]string{...}
```

![screenshot](./screenshot.png)
Expand Down
2 changes: 1 addition & 1 deletion converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func DefaultConverter(addSource bool, replaceAttr func(groups []string, a slog.A
message.Text = record.Message
message.Attachments = []slack.Attachment{
{
Color: colorMap[record.Level],
Color: ColorMapping[record.Level],
Fields: []slack.AttachmentField{},
},
}
Expand Down
2 changes: 1 addition & 1 deletion slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"log/slog"
)

var colorMap = map[slog.Level]string{
var ColorMapping = map[slog.Level]string{
slog.LevelDebug: "#63C5DA",
slog.LevelInfo: "#63C5DA",
slog.LevelWarn: "#FFA500",
Expand Down

0 comments on commit 03211a4

Please sign in to comment.