log connection IDs without the 0x prefix

This commit is contained in:
Marten Seemann
2021-02-10 18:58:31 +08:00
parent 0b97ae5632
commit 6ece64d8a5
6 changed files with 14 additions and 14 deletions

View File

@@ -65,5 +65,5 @@ func (c ConnectionID) String() string {
if c.Len() == 0 {
return "(empty)"
}
return fmt.Sprintf("%#x", c.Bytes())
return fmt.Sprintf("%x", c.Bytes())
}

View File

@@ -93,12 +93,12 @@ var _ = Describe("Connection ID generation", func() {
It("has a string representation", func() {
c := ConnectionID([]byte{0xde, 0xad, 0xbe, 0xef, 0x42})
Expect(c.String()).To(Equal("0xdeadbeef42"))
Expect(c.String()).To(Equal("deadbeef42"))
})
It("has a long string representation", func() {
c := ConnectionID{0x13, 0x37, 0, 0, 0xde, 0xca, 0xfb, 0xad}
Expect(c.String()).To(Equal("0x13370000decafbad"))
Expect(c.String()).To(Equal("13370000decafbad"))
})
It("has a string representation for the default value", func() {