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

Function ExampleContext_IPAddr

log_example_test.go:558–567  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

556}
557
558func ExampleContext_IPAddr() {
559 hostIP := net.IP{192, 168, 0, 100}
560 log := zerolog.New(os.Stdout).With().
561 IPAddr("HostIP", hostIP).
562 Logger()
563
564 log.Log().Msg("hello world")
565
566 // Output: {"HostIP":"192.168.0.100","message":"hello world"}
567}
568
569func ExampleContext_IPAddrs() {
570 hostIP := net.IP{192, 168, 0, 100}

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected