Update readme at example for Caller() (#76)
* Update readme at example for Caller()
This commit is contained in:
parent
dabc72c15b
commit
1a88fbfdd0
10
README.md
10
README.md
|
@ -293,6 +293,16 @@ log.Info().Msg("hello world")
|
|||
log.Logger = log.With().Str("foo", "bar").Logger()
|
||||
```
|
||||
|
||||
### Add file and line number to log
|
||||
|
||||
```go
|
||||
log.Logger = log.With().Caller().Logger()
|
||||
log.Info().Msg("hello world")
|
||||
|
||||
// Output: {"level": "info", "message": "hello world", "caller": "/go/src/your_project/some_file:21"}
|
||||
```
|
||||
|
||||
|
||||
### Thread-safe, lock-free, non-blocking writer
|
||||
|
||||
If your writer might be slow or not thread-safe and you need your log producers to never get slowed down by a slow writer, you can use a `diode.Writer` as follow:
|
||||
|
|
Loading…
Reference in New Issue