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

Function ExampleContext_IPPrefix

log_example_test.go:580–589  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

578}
579
580func ExampleContext_IPPrefix() {
581 route := net.IPNet{IP: net.IP{192, 168, 0, 0}, Mask: net.CIDRMask(24, 32)}
582 log := zerolog.New(os.Stdout).With().
583 IPPrefix("Route", route).
584 Logger()
585
586 log.Log().Msg("hello world")
587
588 // Output: {"Route":"192.168.0.0/24","message":"hello world"}
589}
590
591func ExampleContext_IPPrefixes() {
592 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
IPPrefixMethod · 0.45

Tested by

no test coverage detected