MCPcopy
hub / github.com/rs/zerolog / ExampleEvent_Object

Function ExampleEvent_Object

log_example_test.go:279–291  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

277}
278
279func ExampleEvent_Object() {
280 log := zerolog.New(os.Stdout)
281
282 // User implements zerolog.LogObjectMarshaler
283 u := User{"John", 35, time.Time{}}
284
285 log.Log().
286 Str("foo", "bar").
287 Object("user", u).
288 Msg("hello world")
289
290 // Output: {"foo":"bar","user":{"name":"John","age":35,"created":"0001-01-01T00:00:00Z"},"message":"hello world"}
291}
292
293func ExampleEvent_Objects() {
294 log := zerolog.New(os.Stdout)

Callers

nothing calls this directly

Calls 5

NewFunction · 0.92
MsgMethod · 0.80
LogMethod · 0.65
ObjectMethod · 0.45
StrMethod · 0.45

Tested by

no test coverage detected