mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 15:03:09 -06:00
Log to device messages being received and sent (#55)
* Log to device messages being received and sent * Switch to debug logs instead * Fix a typo
This commit is contained in:
parent
b772f9ee78
commit
6cc9ea3642
|
|
@ -17,6 +17,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/matrix-org/util"
|
"github.com/matrix-org/util"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/clientapi/httputil"
|
"github.com/matrix-org/dendrite/clientapi/httputil"
|
||||||
"github.com/matrix-org/dendrite/clientapi/jsonerror"
|
"github.com/matrix-org/dendrite/clientapi/jsonerror"
|
||||||
|
|
@ -55,6 +56,13 @@ func SendToDevice(
|
||||||
util.GetLogger(req.Context()).WithError(err).Error("eduProducer.SendToDevice failed")
|
util.GetLogger(req.Context()).WithError(err).Error("eduProducer.SendToDevice failed")
|
||||||
return jsonerror.InternalServerError()
|
return jsonerror.InternalServerError()
|
||||||
}
|
}
|
||||||
|
logrus.WithFields(logrus.Fields{
|
||||||
|
"to_device_id": deviceID,
|
||||||
|
"to_user_id": userID,
|
||||||
|
"from_user_id": device.UserID,
|
||||||
|
"from_device_id": device.ID,
|
||||||
|
"type": eventType,
|
||||||
|
}).Debug("to-device-message sent")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import (
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/syncapi/storage"
|
"github.com/matrix-org/dendrite/syncapi/storage"
|
||||||
"github.com/matrix-org/dendrite/syncapi/types"
|
"github.com/matrix-org/dendrite/syncapi/types"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SendToDeviceStreamProvider struct {
|
type SendToDeviceStreamProvider struct {
|
||||||
|
|
@ -54,6 +55,12 @@ func (p *SendToDeviceStreamProvider) IncrementalSync(
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
req.Response.ToDevice.Events = append(req.Response.ToDevice.Events, event.SendToDeviceEvent)
|
req.Response.ToDevice.Events = append(req.Response.ToDevice.Events, event.SendToDeviceEvent)
|
||||||
|
logrus.WithFields(logrus.Fields{
|
||||||
|
"to_device_id": req.Device.ID,
|
||||||
|
"to_user_id": req.Device.UserID,
|
||||||
|
"from_user_id": event.Sender,
|
||||||
|
"type": event.Type,
|
||||||
|
}).Debug("to-device-message received")
|
||||||
}
|
}
|
||||||
|
|
||||||
return lastPos
|
return lastPos
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue