Add logr implementation to README and json.RawMessage to Fields() (#337)

This commit is contained in:
hn8 2021-08-03 17:31:54 +08:00 committed by GitHub
parent c1533bd5f8
commit 164ec91b0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -617,6 +617,7 @@ with zerolog library is [CSD](https://github.com/toravir/csd/).
* [grpc-zerolog](https://github.com/cheapRoc/grpc-zerolog): Implementation of `grpclog.LoggerV2` interface using `zerolog` * [grpc-zerolog](https://github.com/cheapRoc/grpc-zerolog): Implementation of `grpclog.LoggerV2` interface using `zerolog`
* [overlog](https://github.com/Trendyol/overlog): Implementation of `Mapped Diagnostic Context` interface using `zerolog` * [overlog](https://github.com/Trendyol/overlog): Implementation of `Mapped Diagnostic Context` interface using `zerolog`
* [zerologr](https://github.com/hn8/zerologr): Implementation of `logr.LogSink` interface using `zerolog`
## Benchmarks ## Benchmarks

View File

@ -1,6 +1,7 @@
package zerolog package zerolog
import ( import (
"encoding/json"
"net" "net"
"sort" "sort"
"time" "time"
@ -245,6 +246,8 @@ func appendFields(dst []byte, fields map[string]interface{}) []byte {
dst = enc.AppendIPPrefix(dst, val) dst = enc.AppendIPPrefix(dst, val)
case net.HardwareAddr: case net.HardwareAddr:
dst = enc.AppendMACAddr(dst, val) dst = enc.AppendMACAddr(dst, val)
case json.RawMessage:
dst = appendJSON(dst, val)
default: default:
dst = enc.AppendInterface(dst, val) dst = enc.AppendInterface(dst, val)
} }