updat redme

This commit is contained in:
elee 2022-03-20 14:31:02 -05:00
parent c7d28c47c7
commit cc50acd599
1 changed files with 11 additions and 4 deletions

View File

@ -1,3 +1,10 @@
###zlog
opinionated defaults on zerolog
# Zero Allocation JSON Logger
[![godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/git.tuxpa.in/a/zlog) [![license](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://raw.githubusercontent.com/rs/zlog/master/LICENSE) [![Build Status](https://travis-ci.org/rs/zlog.svg?branch=master)](https://travis-ci.org/rs/zlog) [![Coverage](http://gocover.io/_badge/git.tuxpa.in/a/zlog)](http://gocover.io/git.tuxpa.in/a/zlog)
@ -81,7 +88,7 @@ func main() {
Str("Scale", "833 cents").
Float64("Interval", 833.09).
Msg("Fibonacci is everywhere")
log.Debug().
Str("Name", "Tom").
Send()
@ -232,7 +239,7 @@ func main() {
#### Error Logging with Stacktrace
Using `github.com/pkg/errors`, you can add a formatted stacktrace to your errors.
Using `github.com/pkg/errors`, you can add a formatted stacktrace to your errors.
```go
package main
@ -565,7 +572,7 @@ if err := http.ListenAndServe(":8080", nil); err != nil {
```
## Multiple Log Output
`zlog.MultiLevelWriter` may be used to send the log message to multiple outputs.
`zlog.MultiLevelWriter` may be used to send the log message to multiple outputs.
In this example, we send the log message to both `os.Stdout` and the in-built ConsoleWriter.
```go
func main() {
@ -596,7 +603,7 @@ Some settings can be changed and will be applied to all loggers:
* `zlog.ErrorFieldName`: Can be set to customize `Err` field name.
* `zlog.TimeFieldFormat`: Can be set to customize `Time` field value formatting. If set with `zlog.TimeFormatUnix`, `zlog.TimeFormatUnixMs` or `zlog.TimeFormatUnixMicro`, times are formated as UNIX timestamp.
* `zlog.DurationFieldUnit`: Can be set to customize the unit for time.Duration type fields added by `Dur` (default: `time.Millisecond`).
* `zlog.DurationFieldInteger`: If set to `true`, `Dur` fields are formatted as integers instead of floats (default: `false`).
* `zlog.DurationFieldInteger`: If set to `true`, `Dur` fields are formatted as integers instead of floats (default: `false`).
* `zlog.ErrorHandler`: Called whenever zlog fails to write an event on its output. If not set, an error is printed on the stderr. This handler must be thread safe and non-blocking.
## Field Types