Skip to content

Commit fc2cb75

Browse files
authored
Improve interface log format (#831)
1 parent 4be10c3 commit fc2cb75

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/ifaces/informer.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,20 @@ type Interface struct {
4242
NetNS netns.NsHandle
4343
}
4444

45+
func (i Interface) String() string {
46+
return fmt.Sprintf("key=[%s] mac=%v netns=%s", i.InterfaceKey, i.MAC, i.NetNS)
47+
}
48+
4549
type InterfaceKey struct {
4650
Index int
4751
Name string
4852
NSName string
4953
}
5054

55+
func (k InterfaceKey) String() string {
56+
return fmt.Sprintf("index=%d name=%s ns=%s", k.Index, k.Name, k.NSName)
57+
}
58+
5159
func NewInterface(index int, name string, mac [6]uint8, netNS netns.NsHandle, nsname string) Interface {
5260
return Interface{
5361
InterfaceKey: InterfaceKey{

0 commit comments

Comments
 (0)