Improving log messages

Signed-off-by: David Négrier <d.negrier@thecodingmachine.com>
This commit is contained in:
David Négrier 2021-11-08 14:30:54 +01:00
parent 603045bcad
commit 6c6a7e6fe4
3 changed files with 7 additions and 8 deletions

View File

@ -484,7 +484,7 @@ export class GameRoom {
for (const roomListener of this.roomListeners) { for (const roomListener of this.roomListeners) {
emitErrorOnRoomSocket( emitErrorOnRoomSocket(
roomListener, roomListener,
"Your map does not seem accessible from the WorkAdventure servers. Is it behind a firewall or a proxy? Your map should be accessible from the WorkAdventure servers. If you use the scripting API in this map, please be aware that server-side checks and variable persistence is disabled." "Your map '"+this.mapUrl+"' does not seem accessible from the WorkAdventure servers. Is it behind a firewall or a proxy? Your map should be accessible from the WorkAdventure servers. If you use the scripting API in this map, please be aware that server-side checks and variable persistence is disabled."
); );
} }
}, 1000); }, 1000);

View File

@ -308,7 +308,7 @@ export class SocketManager {
const user = room.join(socket, joinRoomMessage); const user = room.join(socket, joinRoomMessage);
clientEventsEmitter.emitClientJoin(user.uuid, roomId); clientEventsEmitter.emitClientJoin(user.uuid, roomId);
console.log(new Date().toISOString() + " A user joined"); console.log(new Date().toISOString() + " user '"+user.uuid+"' joined room '"+roomId+"'");
return { room, user }; return { room, user };
} }

View File

@ -166,7 +166,7 @@ export class SocketManager implements ZoneEventListener {
joinRoomMessage.addCharacterlayer(characterLayerMessage); joinRoomMessage.addCharacterlayer(characterLayerMessage);
} }
console.log("Calling joinRoom"); console.log("Calling joinRoom '"+client.roomId+"' for client "+client.userUuid);
const apiClient = await apiClientRepository.getClient(client.roomId); const apiClient = await apiClientRepository.getClient(client.roomId);
const streamToPusher = apiClient.joinRoom(); const streamToPusher = apiClient.joinRoom();
clientEventsEmitter.emitClientJoin(client.userUuid, client.roomId); clientEventsEmitter.emitClientJoin(client.userUuid, client.roomId);
@ -194,17 +194,16 @@ export class SocketManager implements ZoneEventListener {
} }
}) })
.on("end", () => { .on("end", () => {
console.warn("Connection lost to back server");
// Let's close the front connection if the back connection is closed. This way, we can retry connecting from the start. // Let's close the front connection if the back connection is closed. This way, we can retry connecting from the start.
if (!client.disconnecting) { if (!client.disconnecting) {
this.closeWebsocketConnection(client, 1011, "Connection lost to back server"); this.closeWebsocketConnection(client, 1011, "Connection lost to back server");
} }
console.log("A user left"); console.log("Closed connection for user '"+client.userUuid+"' to back server "+apiClient.getChannel().getTarget());
}) })
.on("error", (err: Error) => { .on("error", (err: Error) => {
console.error("Error in connection to back server:", err); console.error("Error in connection to back server '"+apiClient.getChannel().getTarget()+"':", err);
if (!client.disconnecting) { if (!client.disconnecting) {
this.closeWebsocketConnection(client, 1011, "Error while connecting to back server"); this.closeWebsocketConnection(client, 1011, "Error while connecting to back server '"+apiClient.getChannel().getTarget()+"'");
} }
}); });
@ -353,7 +352,7 @@ export class SocketManager implements ZoneEventListener {
} finally { } finally {
//delete Client.roomId; //delete Client.roomId;
clientEventsEmitter.emitClientLeave(socket.userUuid, socket.roomId); clientEventsEmitter.emitClientLeave(socket.userUuid, socket.roomId);
console.log("A user left"); console.log("User '"+socket.userUuid+"' left");
} }
} }
} finally { } finally {