Revert "Improving log messages"
This commit is contained in:
parent
6c5f330b71
commit
6e6cdc7bde
38 changed files with 203 additions and 581 deletions
|
@ -30,7 +30,6 @@ import { ADMIN_SOCKETS_TOKEN, ADMIN_API_URL, DISABLE_ANONYMOUS, SOCKET_IDLE_TIME
|
|||
import { Zone } from "_Model/Zone";
|
||||
import { ExAdminSocketInterface } from "_Model/Websocket/ExAdminSocketInterface";
|
||||
import { CharacterTexture } from "../Services/AdminApi/CharacterTexture";
|
||||
import log from "../Services/Logger";
|
||||
|
||||
export class IoSocketController {
|
||||
private nextUserId: number = 1;
|
||||
|
@ -53,13 +52,13 @@ export class IoSocketController {
|
|||
const data = jwtTokenManager.verifyAdminSocketToken(token as string);
|
||||
authorizedRoomIds = data.authorizedRoomIds;
|
||||
} catch (e) {
|
||||
log.info("Admin access refused for token: " + token);
|
||||
console.error("Admin access refused for token: " + token);
|
||||
res.writeStatus("401 Unauthorized").end("Incorrect token");
|
||||
return;
|
||||
}
|
||||
const roomId = query.roomId;
|
||||
if (typeof roomId !== "string" || !authorizedRoomIds.includes(roomId)) {
|
||||
log.error("Invalid room id");
|
||||
console.error("Invalid room id");
|
||||
res.writeStatus("403 Bad Request").end("Invalid room id");
|
||||
return;
|
||||
}
|
||||
|
@ -67,7 +66,7 @@ export class IoSocketController {
|
|||
res.upgrade({ roomId }, websocketKey, websocketProtocol, websocketExtensions, context);
|
||||
},
|
||||
open: (ws) => {
|
||||
log.info("Admin socket connect for room: " + ws.roomId);
|
||||
console.log("Admin socket connect for room: " + ws.roomId);
|
||||
ws.disconnecting = false;
|
||||
|
||||
socketManager.handleAdminRoom(ws as ExAdminSocketInterface, ws.roomId as string);
|
||||
|
@ -98,7 +97,7 @@ export class IoSocketController {
|
|||
}
|
||||
}
|
||||
} catch (err) {
|
||||
log.error(err);
|
||||
console.error(err);
|
||||
}
|
||||
},
|
||||
close: (ws, code, message) => {
|
||||
|
@ -107,8 +106,8 @@ export class IoSocketController {
|
|||
Client.disconnecting = true;
|
||||
socketManager.leaveAdminRoom(Client);
|
||||
} catch (e) {
|
||||
log.error('An error occurred on admin "disconnect"');
|
||||
log.error(e);
|
||||
console.error('An error occurred on admin "disconnect"');
|
||||
console.error(e);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
@ -206,7 +205,7 @@ export class IoSocketController {
|
|||
if (err?.response?.status == 404) {
|
||||
// If we get an HTTP 404, the token is invalid. Let's perform an anonymous login!
|
||||
|
||||
log.warn(
|
||||
console.warn(
|
||||
'Cannot find user with email "' +
|
||||
(userIdentifier || "anonymous") +
|
||||
'". Performing an anonymous login instead.'
|
||||
|
@ -246,13 +245,13 @@ export class IoSocketController {
|
|||
throw new Error("Use the login URL to connect");
|
||||
}
|
||||
} catch (e) {
|
||||
log.info(
|
||||
console.log(
|
||||
"access not granted for user " +
|
||||
(userIdentifier || "anonymous") +
|
||||
" and room " +
|
||||
roomId
|
||||
);
|
||||
log.error(e);
|
||||
console.error(e);
|
||||
throw new Error("User cannot access this world");
|
||||
}
|
||||
}
|
||||
|
@ -262,7 +261,7 @@ export class IoSocketController {
|
|||
SocketManager.mergeCharacterLayersAndCustomTextures(characterLayers, memberTextures);
|
||||
|
||||
if (upgradeAborted.aborted) {
|
||||
log.info("Ouch! Client disconnected before we could upgrade it!");
|
||||
console.log("Ouch! Client disconnected before we could upgrade it!");
|
||||
/* You must not upgrade now */
|
||||
return;
|
||||
}
|
||||
|
@ -403,7 +402,7 @@ export class IoSocketController {
|
|||
//let ok = ws.send(message, isBinary);
|
||||
},
|
||||
drain: (ws) => {
|
||||
log.info("WebSocket backpressure: " + ws.getBufferedAmount());
|
||||
console.log("WebSocket backpressure: " + ws.getBufferedAmount());
|
||||
},
|
||||
close: (ws, code, message) => {
|
||||
const Client = ws as ExSocketInterface;
|
||||
|
@ -412,8 +411,8 @@ export class IoSocketController {
|
|||
//leave room
|
||||
socketManager.leaveRoom(Client);
|
||||
} catch (e) {
|
||||
log.error('An error occurred on "disconnect"');
|
||||
log.error(e);
|
||||
console.error('An error occurred on "disconnect"');
|
||||
console.error(e);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue