Skip to content

Commit

Permalink
Update comments and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ykadowak committed Jun 22, 2023
1 parent 0198a0b commit ba43f09
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,17 @@ func main() {

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

// 5. zerolog.Logger case
logger2 := zerolog.New(os.Stdout)
logger2.Info().Send()

// 6. Dispatch in other function case
event := log.Info()
dispatcher(event)
}

func dispatcher(e *zerolog.Event) {
e.Send()
}
```
2 changes: 1 addition & 1 deletion testdata/src/a/a.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func negatives() {
f := &Foo{Bar: &Bar{}}
log.Info().Object("foo", f).Msg("")

// logger instance dispatched within other function
// zerolog.Event dispatched within other function
l := log.Info()
goodDispatcher(l)
}
Expand Down

0 comments on commit ba43f09

Please sign in to comment.