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

Function ExampleEvent_Stringers

log_example_test.go:660–672  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

658}
659
660func ExampleEvent_Stringers() {
661 log := zerolog.New(os.Stdout)
662
663 // net.IP values implement fmt.Stringer and can be used with StringersV
664 a := net.IP{127, 0, 0, 1}
665 b := net.IP{127, 0, 0, 2}
666 ips := []net.IP{a, b}
667
668 log.Log().
669 Stringers("ips", zerolog.AsStringers(ips)).
670 Msg("hello world")
671 // Output: {"ips":["127.0.0.1","127.0.0.2"],"message":"hello world"}
672}
673
674func ExampleContext_StringersV() {
675 // net.IP values implement fmt.Stringer and can be used with StringersV

Callers

nothing calls this directly

Calls 5

NewFunction · 0.92
AsStringersFunction · 0.92
MsgMethod · 0.80
LogMethod · 0.65
StringersMethod · 0.45

Tested by

no test coverage detected