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

Function ExampleContext_StringersV

log_example_test.go:674–686  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

672}
673
674func ExampleContext_StringersV() {
675 // net.IP values implement fmt.Stringer and can be used with StringersV
676 a := net.IPv4bcast
677 b := net.IPv4allrouter
678
679 log := zerolog.New(os.Stdout).With().
680 StringersV("ips", a, b).
681 Logger()
682
683 log.Log().Msg("hello world")
684
685 // Output: {"ips":["255.255.255.255","224.0.0.2"],"message":"hello world"}
686}

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
LoggerMethod · 0.80
WithMethod · 0.80
MsgMethod · 0.80
LogMethod · 0.65
StringersVMethod · 0.45

Tested by

no test coverage detected