From 164ec91b0c3d5d014ed1d2607fd5e49a630d175f Mon Sep 17 00:00:00 2001 From: hn8 <10730886+hn8@users.noreply.github.com> Date: Tue, 3 Aug 2021 17:31:54 +0800 Subject: [PATCH] Add logr implementation to README and json.RawMessage to Fields() (#337) --- README.md | 1 + fields.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 51e3e36..536e3e4 100644 --- a/README.md +++ b/README.md @@ -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` * [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 diff --git a/fields.go b/fields.go index cf3c3e9..907b3f0 100644 --- a/fields.go +++ b/fields.go @@ -1,6 +1,7 @@ package zerolog import ( + "encoding/json" "net" "sort" "time" @@ -245,6 +246,8 @@ func appendFields(dst []byte, fields map[string]interface{}) []byte { dst = enc.AppendIPPrefix(dst, val) case net.HardwareAddr: dst = enc.AppendMACAddr(dst, val) + case json.RawMessage: + dst = appendJSON(dst, val) default: dst = enc.AppendInterface(dst, val) }