| 632 | // Output: {"foo":"bar","v4":"192.168.0.100/24","v6":"2001:db8:85a3::8a2e:370:7300/64","message":"hello world"} |
| 633 | } |
| 634 | func ExampleContext_MACAddr() { |
| 635 | mac := net.HardwareAddr{0x12, 0x34, 0x56, 0x78, 0x90, 0xab} |
| 636 | |
| 637 | dst := bytes.Buffer{} |
| 638 | log := New(&dst).With(). |
| 639 | Str("foo", "bar"). |
| 640 | MACAddr("mac", mac). |
| 641 | Logger() |
| 642 | |
| 643 | log.Log().Msg("hello world") |
| 644 | |
| 645 | fmt.Println(decodeIfBinaryToString(dst.Bytes())) |
| 646 | // Output: {"foo":"bar","mac":"12:34:56:78:90:ab","message":"hello world"} |
| 647 | } |