1
0
mirror of https://github.com/rs/zerolog synced 2026-06-08 17:13:30 +00:00

enable adding raw JSON to an array (#145)

* enable adding JSON to an array

* do not forget the comment
This commit is contained in:
Nelz
2019-11-04 09:47:06 -08:00
committed by Olivier Poitrey
parent 7592fcbe60
commit 5861452d64
2 changed files with 8 additions and 1 deletions
+6
View File
@@ -85,6 +85,12 @@ func (a *Array) Hex(val []byte) *Array {
return a
}
// RawJSON adds already encoded JSON to the array.
func (a *Array) RawJSON(val []byte) *Array {
a.buf = appendJSON(enc.AppendArrayDelim(a.buf), val)
return a
}
// Err serializes and appends the err to the array.
func (a *Array) Err(err error) *Array {
marshaled := ErrorMarshalFunc(err)