Skip to content

Commit

Permalink
Update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kevwan committed Jun 3, 2022
1 parent 323b35e commit 5536473
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions core/logx/readme.md
Expand Up @@ -121,14 +121,13 @@ func (w *KafkaWriter) Write(p []byte) (n int, err error) {
}

func main() {
func main() {
pusher := kq.NewPusher([]string{"localhost:9092"}, "go-zero")
defer pusher.Close()

writer := logx.NewWriter(NewKafkaWriter(pusher))
logx.SetWriter(writer)

// more code
// more code
}
```

Expand Down Expand Up @@ -170,8 +169,8 @@ func (l *SensitiveLogger) Info(msg interface{}, fields ...logx.LogField) {
}

func main() {
// setup logx to make sure originalWriter not nil,
// the injected writer is only for filtering, like a middleware.
// setup logx to make sure originalWriter not nil,
// the injected writer is only for filtering, like a middleware.

originalWriter := logx.Reset()
writer := NewSensitiveLogger(originalWriter)
Expand All @@ -183,7 +182,7 @@ func main() {
Message: "bar",
})

// more code
// more code
}
```

Expand Down

0 comments on commit 5536473

Please sign in to comment.