You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-2Lines changed: 12 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -22,8 +22,8 @@ The linter has several options, so you can adjust it to your own code style.
22
22
23
23
## 🚀 Features
24
24
25
-
*Forbid mixing key-value pairs and attributes within a single function call (default)
26
-
* Enforce using either key-value pairs or attributes for the entire project (optional)
25
+
*Enforce not mixing key-value pairs and attributes (default)
26
+
* Enforce using either key-value pairs only or attributes only (optional)
27
27
* Enforce using methods that accept a context (optional)
28
28
* Enforce using static log messages (optional)
29
29
* Enforce using constants instead of raw keys (optional)
@@ -51,6 +51,16 @@ See the list of [available options][3] to configure the linter.
51
51
52
52
When using `sloglint` standalone, pass the options as flags of the same name.
53
53
54
+
### No mixed arguments
55
+
56
+
The `no-mixed-args` option causes `sloglint` to report mixing key-values pairs and attributes within a single function call:
57
+
58
+
```go
59
+
slog.Info("a user has logged in", "user_id", 42, slog.String("ip_address", "192.0.2.0")) // sloglint: key-value pairs and attributes should not be mixed
60
+
```
61
+
62
+
It is enabled by default.
63
+
54
64
### Key-value pairs only
55
65
56
66
The `kv-only` option causes `sloglint` to report any use of attributes:
0 commit comments