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

Function ExampleContext_IPPrefixes

log_example_test.go:591–600  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

589}
590
591func ExampleContext_IPPrefixes() {
592 route := net.IPNet{IP: net.IP{192, 168, 0, 0}, Mask: net.CIDRMask(24, 32)}
593 log := zerolog.New(os.Stdout).With().
594 IPPrefixes("Route", []net.IPNet{route}).
595 Logger()
596
597 log.Log().Msg("hello world")
598
599 // Output: {"Route":["192.168.0.0/24"],"message":"hello world"}
600}
601
602func ExampleContext_MACAddr() {
603 mac := net.HardwareAddr{0x00, 0x14, 0x22, 0x01, 0x23, 0x45}

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected