Closed MadLittleMods closed 3 years ago
gomatrixserverlib.Event
and gomatrixserverlib.HeaderedEvent
both have a JSON()
function which should do what you need?
Ahhhh, I missed that small declaration, https://github.com/matrix-org/gomatrixserverlib/blob/eb6a8903f9fb261e2feb61017dc581b259a6aa82/event.go#L442-L443
Thanks for the shout!
My goal is to easily dump the events and understand what I am working with in Dendrite ->
syncapi/storage/shared/syncserver.go#L889
Is there way to use the JSON marshal/unmarshal stuff?
Can we expose
Event.eventJSON
for easy debug logging?Brought up while working on https://github.com/matrix-org/dendrite/pull/1671#discussion_r550703621
What have I tried?
✅ Decent but a lot of boilerplate to log and wish it was pretty-printed
:x: Not possible since
eventJSON
is not exported (lowercase)✖️ A bunch of unreadable byte arrays mixed in with some information
✖️ Still not readable with all of the byte streams
✖️ For whatever reason, when running in Sytest, it's cut-off and truncated like this. Even if not cut-off, probably has same byte stream problems as above: