Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ykadowak committed Jun 5, 2023
1 parent b69af3f commit ff0e607
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# zerologlint
![build](https://github.com/ykadowak/zerologlint/actions/workflows/testing.yaml/badge.svg)

`zerologlint` is a linter for [zerolog](https://github.com/rs/zerolog) that can be run with `go vet`.
It detects the wrong usage of `zerolog` that a user forgets to dispatch `zerolog.Event` with `Send` or `Msg` like functions, in which case nothing will be logged. For more detailed explanations of the cases it detects, see [Example](#Example).
`zerologlint` is a linter for [zerolog](https://github.com/rs/zerolog) that can be run with `go vet` or through [golangci-lint](https://golangci-lint.run/) since `v1.53.0`.
It detects the wrong usage of `zerolog` that a user forgets to dispatch `zerolog.Event` with `Send` or `Msg` like functions, in which case nothing will be logged. For more detailed explanations of the cases it detects, see [Examples](#Example).

## Install

Expand All @@ -15,7 +15,9 @@ go install github.com/ykadowak/zerologlint/cmd/zerologlint@latest
go vet -vettool=`which zerologlint` ./...
```

## Example
or you can also use it with [golangci-lint](https://golangci-lint.run/) since `v1.53.0`.

## Examples
```go
package main

Expand All @@ -42,5 +44,8 @@ func main() {
logger = log.Error() // "must be dispatched by Msg or Send method"
}
logger.Str("foo", "bar")

// 4. Deferred case
defer log.Info() // "must be dispatched by Msg or Send method"
}
```

0 comments on commit ff0e607

Please sign in to comment.