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

10 Commits

Author SHA1 Message Date
Marc Brooks 0cf9361666 Fix missing context.Context in Object/EmbedObject (#737)
Copies over event settings for ctx, hooks, and stack

- Fix missing context for Event.appendObjects passes event's stack, ctx, and hooks (ch).
- Add Array.Errs support.
- Context.Errs, Event.Errs,  use new Array.Errs()
- Array.Err handles nil correctly.
- Fix Event.Err code ignoring modified event in ErrorStackMarshaler handling.
- Fix Fields.appendFieldList when ErrorMarshalFunc returns a nil.
- Fields.appendFieldList does no longer adds the ErrorStackFieldName field when ErrorStackMarshaler returns nil.
- Don't call the ErrorMarshalFunc on nil errors.
- Removed unreachable code NOP in Context.Array
- Rewrite ErrorMarshalFunc testing.
- Made diode tests more stable.
- Log copy error in test.
- Address review comments
- Added CreateArray() and CreateDict() for both Context and Event and deprecate the Arr() and Dict().
Array now carries then stack/context/hooks so they are available to LogObjectMarshal of Array elements.
Added unit tests for error marshal that returns an interface{}
2026-01-05 18:19:15 +00:00
Marc Brooks a64148507a Adds Objects field type to logger fields, events, and context (#736)
* Improve code coverage before adding Objects

* Refactor ErrorMarshal tests.

Added testing of the error marshal in Fields Reduce the duplication of the test data and make it clearer what the "wants" represent.

* Add Objects support to Fields, Event, Context

* Add support for Object Fields

Passed as []LogObjectMarshaler.

* Fixed syntax of ExampleContext_Objects

Seems 1.24 accepts variadic for arrays and understands covariance but 1.21 doesn't.

* Fix problem with []uint8 serialized as a Base64 string

* Better syntax in the example use of Objects
2025-12-18 18:50:34 +00:00
Marc Brooks 5391dd7c34 Add array handling of IPAddr and IPPrefix (#734)
* Add array handling of IPAddr and IPPrefix

Updated documentation, benchmark, and tests including catching up some missing.
Cleaned up couple lint messages

* Added cbor encoding for []net.IP and []net.IPNet

* Fix binary_test

Typos galore, thanks CI

* Remove feral x character

* Added IPAddrs and IPPrefixes tests for json encoder
2025-12-06 13:12:45 +01:00
Olivier Poitrey a21d6107dc Remvoe ExampleBinaryNew referring to nothing 2025-03-24 16:31:31 +01:00
Sami Kerola 83e03c75d9 stop using deprecated io/ioutils package (#620) (#620) 2023-11-24 22:16:01 +01:00
hn8 65adfd88ec Make Fields method accept both map and slice (#352) 2021-09-08 18:00:06 +02:00
CrazyMax 4502cc1942 Add TraceLevel (#158) 2019-11-04 11:39:22 -08:00
Olivier Poitrey 2da253048d Fix binary test too 2018-09-16 19:15:55 -07:00
Ravi Raju a025d45231 EmbedObject() API and knob to change caller frames (#66)
* Fix for a bug in cbor decodeFloat
* Add EmbedObject() method
* knob to change the depth of caller frames to skip
* removed EmbedObj() for array - since it is same as Object()
2018-05-16 18:42:33 -07:00
Ravi Raju ddfae1b613 Binary format support (#37)
Adds support for binary logging (with cbor encoding) in addition to JSON. Use the binary_log compile tag to enable the feature.
2018-03-28 11:49:41 -07:00