Update log events.
This commit is contained in:
parent
8360070711
commit
d8d43a9d06
1 changed files with 3 additions and 3 deletions
|
|
@ -6,7 +6,7 @@ export default (io: Server, socket: Socket, data: DeleteGame) => {
|
||||||
|
|
||||||
// Ensure game exists
|
// Ensure game exists
|
||||||
if (!games[data.game_code]) {
|
if (!games[data.game_code]) {
|
||||||
log.debug(`Can't delete game that doesn't exist: ${data.game_code}`);
|
log.debug(`Can't find game with code: ${data.game_code}`);
|
||||||
socket.emit(`GameDeleted`, {
|
socket.emit(`GameDeleted`, {
|
||||||
status: 404,
|
status: 404,
|
||||||
message: `Game with code ${data.game_code} could not be found`,
|
message: `Game with code ${data.game_code} could not be found`,
|
||||||
|
|
@ -21,7 +21,7 @@ export default (io: Server, socket: Socket, data: DeleteGame) => {
|
||||||
let player = game.players.find(x => x.isHost);
|
let player = game.players.find(x => x.isHost);
|
||||||
|
|
||||||
if (player != null && player.socket !== socket) {
|
if (player != null && player.socket !== socket) {
|
||||||
game.log.warn(`${player.name} attempted to delete game.`);
|
game.log.warn(`${player.name} attempted to delete game`);
|
||||||
socket.emit(`GameDeleted`, {
|
socket.emit(`GameDeleted`, {
|
||||||
status: 403,
|
status: 403,
|
||||||
message: `Not allowed to delete a game that you are not the host of.`,
|
message: `Not allowed to delete a game that you are not the host of.`,
|
||||||
|
|
@ -31,7 +31,7 @@ export default (io: Server, socket: Socket, data: DeleteGame) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Delete game
|
// Delete game
|
||||||
game.log.debug(`Game deleted.`)
|
game.log.info(`Game deleted`)
|
||||||
delete games[data.game_code];
|
delete games[data.game_code];
|
||||||
io.to(game.id).emit(`GameDeleted`, {
|
io.to(game.id).emit(`GameDeleted`, {
|
||||||
status: 200,
|
status: 200,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue