logging for roomserver

This commit is contained in:
Richard van der Hoff 2017-12-19 10:48:36 +00:00
parent ebb8d5b268
commit a76ed709cb

View file

@ -23,6 +23,7 @@ import (
"github.com/matrix-org/dendrite/roomserver/state" "github.com/matrix-org/dendrite/roomserver/state"
"github.com/matrix-org/dendrite/roomserver/types" "github.com/matrix-org/dendrite/roomserver/types"
"github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/util"
) )
// A RoomEventDatabase has the storage APIs needed to store a room event. // A RoomEventDatabase has the storage APIs needed to store a room event.
@ -80,16 +81,21 @@ func processRoomEvent(
ow OutputRoomEventWriter, ow OutputRoomEventWriter,
input api.InputRoomEvent, input api.InputRoomEvent,
) error { ) error {
logger := util.GetLogger(ctx)
logger.Info("Parsing event")
// Parse and validate the event JSON // Parse and validate the event JSON
event := input.Event event := input.Event
// Check that the event passes authentication checks and work out the numeric IDs for the auth events. // Check that the event passes authentication checks and work out the numeric IDs for the auth events.
logger.Info("Check auth events")
authEventNIDs, err := checkAuthEvents(ctx, db, event, input.AuthEventIDs) authEventNIDs, err := checkAuthEvents(ctx, db, event, input.AuthEventIDs)
if err != nil { if err != nil {
return err return err
} }
// Store the event // Store the event
logger.Info("Store event")
roomNID, stateAtEvent, err := db.StoreEvent(ctx, event, authEventNIDs) roomNID, stateAtEvent, err := db.StoreEvent(ctx, event, authEventNIDs)
if err != nil { if err != nil {
return err return err
@ -103,6 +109,7 @@ func processRoomEvent(
} }
if stateAtEvent.BeforeStateSnapshotNID == 0 { if stateAtEvent.BeforeStateSnapshotNID == 0 {
logger.Info("Calculate state")
// We haven't calculated a state for this event yet. // We haven't calculated a state for this event yet.
// Lets calculate one. // Lets calculate one.
if input.HasState { if input.HasState {
@ -134,6 +141,7 @@ func processRoomEvent(
} }
// Update the extremities of the event graph for the room // Update the extremities of the event graph for the room
logger.Info("Update extremities")
return updateLatestEvents(ctx, db, ow, roomNID, stateAtEvent, event, input.SendAsServer, input.TransactionID) return updateLatestEvents(ctx, db, ow, roomNID, stateAtEvent, event, input.SendAsServer, input.TransactionID)
} }