Add user to collaboration logs
This commit is contained in:
@@ -1,19 +1,26 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import Logger from "../logging/logger";
|
import Logger from "../logging/logger";
|
||||||
|
import { User } from "../models";
|
||||||
|
|
||||||
export default class CollaborationLogger {
|
export default class CollaborationLogger {
|
||||||
async onCreateDocument(data: { documentName: string }) {
|
async onCreateDocument(data: {
|
||||||
Logger.info("hocuspocus", `Created document "${data.documentName}"`);
|
documentName: string,
|
||||||
|
context: { user: User },
|
||||||
|
}) {
|
||||||
|
Logger.info("hocuspocus", `Created document "${data.documentName}"`, {
|
||||||
|
userId: data.context.user.id,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async onConnect(data: { documentName: string }) {
|
async onConnect(data: { documentName: string, context: { user: User } }) {
|
||||||
Logger.info("hocuspocus", `New connection to "${data.documentName}"`);
|
Logger.info("hocuspocus", `New connection to "${data.documentName}"`, {
|
||||||
|
userId: data.context.user.id,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async onDisconnect(data: { documentName: string }) {
|
async onDisconnect(data: { documentName: string, context: { user: User } }) {
|
||||||
Logger.info("hocuspocus", `Connection to "${data.documentName}" closed`);
|
Logger.info("hocuspocus", `Connection to "${data.documentName}" closed `, {
|
||||||
}
|
userId: data.context.user.id,
|
||||||
|
});
|
||||||
async onUpgrade() {
|
|
||||||
Logger.info("hocuspocus", "Upgrading connection");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user