Skip to content

Commit 4ed54fa

Browse files
authored
docs: update README
Signed-off-by: tmzane <73077675+tmzane@users.noreply.github.com>
1 parent ed5057e commit 4ed54fa

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

README.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,8 @@ A Go linter that ensures consistent code style when using `log/slog`.
1010
## 📌 About
1111

1212
The `log/slog` API allows two different types of arguments: key-value pairs and attributes.
13-
People may have different opinions about which one is better,
14-
but nobody probably wants to mix them up because it makes the code harder to read:
15-
16-
```go
17-
slog.Info("a user has logged in", "user_id", 42, slog.String("ip_address", "192.0.2.0")) // ugh
18-
```
19-
20-
`sloglint` finds such function calls and checks that all the arguments are either key-value pairs or attributes.
21-
The linter has several options, so you can adjust it to your own code style.
13+
While people may have different opinions about which one is better, most seem to agree on one thing: it should be consistent.
14+
With `sloglint` you can enforce various rules for `log/slog` based on your preferred code style.
2215

2316
## 🚀 Features
2417

@@ -134,7 +127,8 @@ func UserId(value int) slog.Attr { return slog.Int("user_id", value) }
134127
slog.Info("a user has logged in", UserId(42))
135128
```
136129

137-
> 💡 Such helpers can be automatically generated for you by the [`sloggen`][4] tool. Give it a try too!
130+
> [!TIP]
131+
> Such helpers can be automatically generated for you by the [`sloggen`][4] tool. Give it a try too!
138132

139133
### Key naming convention
140134

0 commit comments

Comments
 (0)