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

Function ExampleContext_IPAddrs

log_example_test.go:569–578  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

567}
568
569func ExampleContext_IPAddrs() {
570 hostIP := net.IP{192, 168, 0, 100}
571 log := zerolog.New(os.Stdout).With().
572 IPAddrs("HostIP", []net.IP{hostIP}).
573 Logger()
574
575 log.Log().Msg("hello world")
576
577 // Output: {"HostIP":["192.168.0.100"],"message":"hello world"}
578}
579
580func ExampleContext_IPPrefix() {
581 route := net.IPNet{IP: net.IP{192, 168, 0, 0}, Mask: net.CIDRMask(24, 32)}

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected