updat redme
This commit is contained in:
parent
c7d28c47c7
commit
cc50acd599
15
README.md
15
README.md
|
@ -1,3 +1,10 @@
|
||||||
|
###zlog
|
||||||
|
|
||||||
|
opinionated defaults on zerolog
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Zero Allocation JSON Logger
|
# 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)
|
[![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").
|
Str("Scale", "833 cents").
|
||||||
Float64("Interval", 833.09).
|
Float64("Interval", 833.09).
|
||||||
Msg("Fibonacci is everywhere")
|
Msg("Fibonacci is everywhere")
|
||||||
|
|
||||||
log.Debug().
|
log.Debug().
|
||||||
Str("Name", "Tom").
|
Str("Name", "Tom").
|
||||||
Send()
|
Send()
|
||||||
|
@ -232,7 +239,7 @@ func main() {
|
||||||
|
|
||||||
#### Error Logging with Stacktrace
|
#### 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
|
```go
|
||||||
package main
|
package main
|
||||||
|
@ -565,7 +572,7 @@ if err := http.ListenAndServe(":8080", nil); err != nil {
|
||||||
```
|
```
|
||||||
|
|
||||||
## Multiple Log Output
|
## 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.
|
In this example, we send the log message to both `os.Stdout` and the in-built ConsoleWriter.
|
||||||
```go
|
```go
|
||||||
func main() {
|
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.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.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.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.
|
* `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
|
## Field Types
|
||||||
|
|
Loading…
Reference in New Issue