Skip to content

Commit

Permalink
Fix logger example (segmentio#871)
Browse files Browse the repository at this point in the history
Since `msg` is formatted we should call `Printf` because `Println` doesn't support variadic arguments
  • Loading branch information
route authored Mar 22, 2022
1 parent a9325a2 commit 6b6b5bd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,8 @@ For visiblity into the operations of the Reader/Writer types, configure a logger

```go
func logf(msg string, a ...interface{}) {
fmt.Println(msg, a...)
fmt.Printf(msg, a...)
fmt.Println()
}

r := kafka.NewReader(kafka.ReaderConfig{
Expand All @@ -713,7 +714,8 @@ r := kafka.NewReader(kafka.ReaderConfig{

```go
func logf(msg string, a ...interface{}) {
fmt.Println(msg, a...)
fmt.Printf(msg, a...)
fmt.Println()
}

w := &kafka.Writer{
Expand Down

0 comments on commit 6b6b5bd

Please sign in to comment.