Skip to content

Commit 7f0624a

Browse files
committed
Document the new behavior of Fluent.Close()
d7068a9 changed the behavior of `Fluent.Close()` so that it finalizes the logger instance inrevocably. This adds documentation about the new behavior in README.md Signed-off-by: Fujimoto Seiji <fujimoto@ceptord.net>
1 parent 1aa5555 commit 7f0624a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,24 @@ Skip verifying the server certificate. Useful for development and testing. The d
159159

160160
This logger doesn't support those features. Patches are welcome!
161161

162+
### Is it allowed to call `Fluent.Post()` after connection close?
163+
164+
Before v1.8.0, the Fluent logger silently reopened connections whenever
165+
`Fluent.Post()` was called.
166+
167+
```go
168+
logger, _ := fluent.New(fluent.Config{})
169+
logger.Post(tag, data)
170+
logger.Close()
171+
logger.Post(tag, data) /* reopen connection */
172+
```
173+
174+
However, this behavior was confusing, in particular when multiple goroutines
175+
were involved. Starting v1.8.0, the logger no longer accepts `Fluent.Post()`
176+
after `Fluent.Close()`, and instead returns a "Logger already closed" error.
177+
162178
## Tests
163179
```
180+
164181
go test
165182
```

0 commit comments

Comments
 (0)