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

Function ExampleContext_MACAddr

log_example_test.go:602–611  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

600}
601
602func ExampleContext_MACAddr() {
603 mac := net.HardwareAddr{0x00, 0x14, 0x22, 0x01, 0x23, 0x45}
604 log := zerolog.New(os.Stdout).With().
605 MACAddr("hostMAC", mac).
606 Logger()
607
608 log.Log().Msg("hello world")
609
610 // Output: {"hostMAC":"00:14:22:01:23:45","message":"hello world"}
611}
612
613func ExampleContext_Fields_map() {
614 fields := map[string]interface{}{

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected