Skip to content

Commit

Permalink
fix: cleanup verbose logs (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrappachc authored Feb 18, 2020
1 parent f728ea8 commit b27d977
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/game-servers/services/game-servers.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class GameServersService {
if (gameServer) {
gameServer.isFree = false;
await gameServer.save();
this.logger.verbose(`game server ${gameServerId} (${gameServer.name}) marked as taken`);
this.logger.debug(`game server ${gameServerId} (${gameServer.name}) marked as taken`);
return gameServer;
} else {
throw new Error('no such game server');
Expand All @@ -77,7 +77,7 @@ export class GameServersService {
if (gameServer) {
gameServer.isFree = true;
await gameServer.save();
this.logger.verbose(`game server ${gameServerId} (${gameServer.name}) marked as free`);
this.logger.debug(`game server ${gameServerId} (${gameServer.name}) marked as free`);
return gameServer;
} else {
throw new Error('no such game server');
Expand Down
2 changes: 1 addition & 1 deletion src/games/services/player-substitution.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class PlayerSubstitutionService {
}

const player = await this.playersService.getById(playerId);
this.logger.verbose(`player ${player.name} taking part in game #${game.number} is marked as 'waiting for substitute'`);
this.logger.debug(`player ${player.name} taking part in game #${game.number} is marked as 'waiting for substitute'`);

slot.status = 'waiting for substitute';
await game.save();
Expand Down
14 changes: 7 additions & 7 deletions src/queue/services/queue.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class QueueService implements OnModuleInit {

reset() {
this.resetSlots();
this.logger.verbose('queue reset');
this.logger.debug('queue reset');
this._slotsChange.next(this.slots);
setImmediate(() => this.maybeUpdateState());
}
Expand Down Expand Up @@ -153,7 +153,7 @@ export class QueueService implements OnModuleInit {
targetSlot.ready = true;
}

this.logger.verbose(`player ${player.name} joined the queue (slotId=${targetSlot.id}, gameClass=${targetSlot.gameClass})`);
this.logger.debug(`player ${player.name} joined the queue (slotId=${targetSlot.id}, gameClass=${targetSlot.gameClass})`);

// is player joining instead of only changing slots?
if (oldSlots.length === 0) {
Expand All @@ -174,7 +174,7 @@ export class QueueService implements OnModuleInit {
}

this.clearSlot(slot);
this.logger.verbose(`slot ${slot.id} (gameClass=${slot.gameClass}) free`);
this.logger.debug(`slot ${slot.id} (gameClass=${slot.gameClass}) free`);
this._playerLeave.next(playerId);
this._slotsChange.next([ slot ]);
setImmediate(() => this.maybeUpdateState());
Expand All @@ -196,7 +196,7 @@ export class QueueService implements OnModuleInit {
if (slot) {
this.clearSlot(slot);
this._playerLeave.next(playerId);
this.logger.verbose(`slot ${slot.id} (gameClass=${slot.gameClass}) free (player was kicked)`);
this.logger.debug(`slot ${slot.id} (gameClass=${slot.gameClass}) free (player was kicked)`);
updatedSlots.push(slot);
}
}
Expand All @@ -213,7 +213,7 @@ export class QueueService implements OnModuleInit {
const slot = this.findSlotByPlayerId(playerId);
if (slot) {
slot.ready = true;
this.logger.verbose(`slot ${slot.id} ready (${this.readyPlayerCount}/${this.requiredPlayerCount})`);
this.logger.debug(`slot ${slot.id} ready (${this.readyPlayerCount}/${this.requiredPlayerCount})`);
this._slotsChange.next([ slot ]);
setImmediate(() => this.maybeUpdateState());
return slot;
Expand Down Expand Up @@ -280,7 +280,7 @@ export class QueueService implements OnModuleInit {
clearTimeout(this.timer);
}

this.logger.verbose(`queue state change (${oldState} => ${newState})`);
this.logger.debug(`queue state change (${oldState} => ${newState})`);
}

private onReadyUpTimeout() {
Expand All @@ -298,7 +298,7 @@ export class QueueService implements OnModuleInit {
}

private kickUnreadyPlayers() {
this.logger.verbose('kicking players that are not ready');
this.logger.debug('kicking players that are not ready');
const slots = this.slots.filter(s => !s.ready);
this.kick(...slots.map(s => s.playerId));
}
Expand Down

0 comments on commit b27d977

Please sign in to comment.