You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Keys (and Values) of course may well contain arbitrary byte sequences. The escaping I implemented is more meant to "look nice, and compact, in logs" than being a reliable bi-directional "codec" (i.e. my goal was only to be able to go from byte[] to readable text, NOT to come up with a representation where said text can be re-transformed into a byte[]). It looks like e.g. «A·00B·FF» for 4 bytes ('A', 0 b, 'B', FF b).
PS: ByteSequence does have a toString(Charset) but that is not for debug logging, and perhaps should have instead better be named getString(), like its getBytes(), or even asString(), but it's already too late for that now, I guess?)
PPS: Perhaps etcdctl ls could print using the same format? I'll file an issue there.
The text was updated successfully, but these errors were encountered:
I don't think platform default is a good choice in a cluster application. I would either use UTF-8, make it configurable or return a hey string from toString.
For debugging, I've found it sometimes useful to log the ByteSequence of a KV.
Our
io.etcd.jetcd.data.ByteSequence
currently does not implementjava.lang.Object.toString()
.I have therefore implemented this helper utility for this (see also its usage in ByteSequencesTest), and was wondering if a contribution with that here would be welcome?
Keys (and Values) of course may well contain arbitrary byte sequences. The escaping I implemented is more meant to "look nice, and compact, in logs" than being a reliable bi-directional "codec" (i.e. my goal was only to be able to go from byte[] to readable text, NOT to come up with a representation where said text can be re-transformed into a byte[]). It looks like e.g. «A·00B·FF» for 4 bytes ('A', 0 b, 'B', FF b).
PS:
ByteSequence
does have atoString(Charset)
but that is not for debug logging, and perhaps should have instead better be namedgetString()
, like itsgetBytes()
, or evenasString()
, but it's already too late for that now, I guess?)PPS: Perhaps
etcdctl ls
could print using the same format? I'll file an issue there.The text was updated successfully, but these errors were encountered: