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

Function ExampleEvent_EmbedObject

log_example_test.go:321–332  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

319}
320
321func ExampleEvent_EmbedObject() {
322 log := zerolog.New(os.Stdout)
323
324 price := Price{val: 6449, prec: 2, unit: "$"}
325
326 log.Log().
327 Str("foo", "bar").
328 EmbedObject(price).
329 Msg("hello world")
330
331 // Output: {"foo":"bar","price":"$64.49","message":"hello world"}
332}
333
334func ExampleEvent_Interface() {
335 log := zerolog.New(os.Stdout)

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected