celestiaorg/nmt

Pretty print namespace.ID

Closed this issue · 1 comments

In celestia-node we rely a lot on nmt namespace.ID type and want to log it in multiple places in human readable manner(hex representation). Current implementation of String() method on namespace.ID does direct convertion to string type, and makes it impossible to read.
I wonder if other users of nmt pkg would benefit from ability to pretty print namespace.ID. If so there could be 2 options:

  • changing existing String() method (would break compatibility)
  • add extra method HexString.

add extra method HexString.

Sounds like a good idea to me!