Revert "Improving log messages"

This commit is contained in:
David Négrier
2021-11-24 16:20:07 +01:00
committed by GitHub
parent 6c5f330b71
commit 6e6cdc7bde
38 changed files with 203 additions and 581 deletions
+17 -18
View File
@@ -56,7 +56,6 @@ import { Zone } from "_Model/Zone";
import Debug from "debug";
import { Admin } from "_Model/Admin";
import crypto from "crypto";
import log from "./Logger";
const debug = Debug("sockermanager");
@@ -90,7 +89,7 @@ export class SocketManager {
const { room, user } = await this.joinRoom(socket, joinRoomMessage);
if (!socket.writable) {
log.warn("Socket was aborted");
console.warn("Socket was aborted");
return {
room,
user,
@@ -157,7 +156,7 @@ export class SocketManager {
name: playerDetailsMessage.getName(),
characterLayers: playerDetailsMessage.getCharacterlayersList()
};
//log.info(SocketIoEvent.SET_PLAYER_DETAILS, playerDetails);
//console.log(SocketIoEvent.SET_PLAYER_DETAILS, playerDetails);
if (!isSetPlayerDetailsMessage(playerDetails)) {
emitError(client, 'Invalid SET_PLAYER_DETAILS message received: ');
return;
@@ -193,7 +192,7 @@ export class SocketManager {
//send only at user
const remoteUser = room.getUsers().get(data.getReceiverid());
if (remoteUser === undefined) {
log.warn(
console.warn(
"While exchanging a WebRTC signal: client with id ",
data.getReceiverid(),
" does not exist. This might be a race condition."
@@ -223,7 +222,7 @@ export class SocketManager {
//send only at user
const remoteUser = room.getUsers().get(data.getReceiverid());
if (remoteUser === undefined) {
log.warn(
console.warn(
"While exchanging a WEBRTC_SCREEN_SHARING signal: client with id ",
data.getReceiverid(),
" does not exist. This might be a race condition."
@@ -261,7 +260,7 @@ export class SocketManager {
}
} finally {
clientEventsEmitter.emitClientLeave(user.uuid, room.roomUrl);
log.info("A user left");
console.log("A user left");
}
}
@@ -309,7 +308,7 @@ export class SocketManager {
const user = room.join(socket, joinRoomMessage);
clientEventsEmitter.emitClientJoin(user.uuid, roomId);
log.info(new Date().toISOString() + " user '" + user.uuid + "' joined room '" + roomId + "'");
console.log(new Date().toISOString() + " A user joined");
return { room, user };
}
@@ -338,7 +337,7 @@ export class SocketManager {
} else if (thing instanceof Group) {
this.emitCreateUpdateGroupEvent(listener, fromZone, thing);
} else {
log.error("Unexpected type for Movable.");
console.error("Unexpected type for Movable.");
}
}
@@ -353,11 +352,11 @@ export class SocketManager {
emitZoneMessage(subMessage, listener);
//listener.emitInBatch(subMessage);
//log.info("Sending USER_MOVED event");
//console.log("Sending USER_MOVED event");
} else if (thing instanceof Group) {
this.emitCreateUpdateGroupEvent(listener, null, thing);
} else {
log.error("Unexpected type for Movable.");
console.error("Unexpected type for Movable.");
}
}
@@ -367,7 +366,7 @@ export class SocketManager {
} else if (thing instanceof Group) {
this.emitDeleteGroupEvent(listener, thing.getId(), newZone);
} else {
log.error("Unexpected type for Movable.");
console.error("Unexpected type for Movable.");
}
}
@@ -636,7 +635,7 @@ export class SocketManager {
batchMessage.addPayload(subMessage);
} else {
log.error("Unexpected type for Movable returned by setViewport");
console.error("Unexpected type for Movable returned by setViewport");
}
}
@@ -694,7 +693,7 @@ export class SocketManager {
public async sendAdminMessage(roomId: string, recipientUuid: string, message: string): Promise<void> {
const room = await this.roomsPromises.get(roomId);
if (!room) {
log.error(
console.error(
"In sendAdminMessage, could not find room with id '" +
roomId +
"'. Maybe the room was closed a few milliseconds ago and there was a race condition?"
@@ -704,7 +703,7 @@ export class SocketManager {
const recipients = room.getUsersByUuid(recipientUuid);
if (recipients.length === 0) {
log.error(
console.error(
"In sendAdminMessage, could not find user with id '" +
recipientUuid +
"'. Maybe the user left the room a few milliseconds ago and there was a race condition?"
@@ -727,7 +726,7 @@ export class SocketManager {
public async banUser(roomId: string, recipientUuid: string, message: string): Promise<void> {
const room = await this.roomsPromises.get(roomId);
if (!room) {
log.error(
console.error(
"In banUser, could not find room with id '" +
roomId +
"'. Maybe the room was closed a few milliseconds ago and there was a race condition?"
@@ -737,7 +736,7 @@ export class SocketManager {
const recipients = room.getUsersByUuid(recipientUuid);
if (recipients.length === 0) {
log.error(
console.error(
"In banUser, could not find user with id '" +
recipientUuid +
"'. Maybe the user left the room a few milliseconds ago and there was a race condition?"
@@ -766,7 +765,7 @@ export class SocketManager {
const room = await this.roomsPromises.get(roomId);
if (!room) {
//todo: this should cause the http call to return a 500
log.error(
console.error(
"In sendAdminRoomMessage, could not find room with id '" +
roomId +
"'. Maybe the room was closed a few milliseconds ago and there was a race condition?"
@@ -790,7 +789,7 @@ export class SocketManager {
const room = await this.roomsPromises.get(roomId);
if (!room) {
//todo: this should cause the http call to return a 500
log.error(
console.error(
"In dispatchWorldFullWarning, could not find room with id '" +
roomId +
"'. Maybe the room was closed a few milliseconds ago and there was a race condition?"