diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-01-31 15:33:00 +0000 |
---|---|---|
committer | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-01-31 15:33:00 +0000 |
commit | 07d0e72a8b2fd48cac50026346be4810c5768d36 (patch) | |
tree | 01bc02831ab0a1c5181a05350d14f2fc61ac7b51 /roomserver | |
parent | d21f3eace0748e0b1385243be50c89d0d55c32d0 (diff) |
Improve roomserver logging
Diffstat (limited to 'roomserver')
-rw-r--r-- | roomserver/api/input.go | 13 | ||||
-rw-r--r-- | roomserver/internal/input/input_events.go | 8 |
2 files changed, 21 insertions, 0 deletions
diff --git a/roomserver/api/input.go b/roomserver/api/input.go index 4b0704b9..45a9ef49 100644 --- a/roomserver/api/input.go +++ b/roomserver/api/input.go @@ -42,6 +42,19 @@ const ( KindOld ) +func (k Kind) String() string { + switch k { + case KindOutlier: + return "KindOutlier" + case KindNew: + return "KindNew" + case KindOld: + return "KindOld" + default: + return "(unknown)" + } +} + // DoNotSendToOtherServers tells us not to send the event to other matrix // servers. const DoNotSendToOtherServers = "" diff --git a/roomserver/internal/input/input_events.go b/roomserver/internal/input/input_events.go index 147103cf..16703616 100644 --- a/roomserver/internal/input/input_events.go +++ b/roomserver/internal/input/input_events.go @@ -93,8 +93,16 @@ func (r *Inputer) processRoomEvent( logger := util.GetLogger(ctx).WithFields(logrus.Fields{ "event_id": event.EventID(), "room_id": event.RoomID(), + "kind": input.Kind, + "origin": input.Origin, "type": event.Type(), }) + if input.HasState { + logger = logger.WithFields(logrus.Fields{ + "has_state": input.HasState, + "state_ids": len(input.StateEventIDs), + }) + } // if we have already got this event then do not process it again, if the input kind is an outlier. // Outliers contain no extra information which may warrant a re-processing. |