Begin using the tslog module
This commit is contained in:
parent
1578df961c
commit
564206dd8b
2 changed files with 10 additions and 6 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { Logger } from "tslog";
|
||||
import * as sio from "socket.io";
|
||||
import { writeFileSync } from "fs";
|
||||
import { Vote } from "./events/Vote";
|
||||
|
|
@ -15,6 +16,9 @@ import { NextPresident } from "./events/special/SpecialElection/NextPresident";
|
|||
import { ExecutiveConfirmation } from "./events/special/ExecutiveConfirmation";
|
||||
import { InvestigateAffiliation } from "./events/special/InvestigateLoyalty/InvestigateAffiliation";
|
||||
|
||||
export var log: Logger = new Logger({
|
||||
displayLogLevel: true,
|
||||
});
|
||||
|
||||
export var active_games: {[key: string]: Game} = {};
|
||||
|
||||
|
|
@ -29,7 +33,7 @@ function clean_up() {
|
|||
console.log(`Writing game: ${code} to disk`);
|
||||
writeFileSync(`${db_dir}/${code}`, active_games[code].toJSON());
|
||||
};
|
||||
console.log(`Finished saving games to disk.`);
|
||||
log.info(`Finished saving games to disk.`);
|
||||
}
|
||||
|
||||
// Listen to the signals for the cleanup requirement
|
||||
|
|
@ -39,7 +43,7 @@ process.on('SIGINT', clean_up);
|
|||
const io = sio.listen(3000);
|
||||
|
||||
io.on(`connection`, (socket: sio.Socket) => {
|
||||
console.log(`Client connected`);
|
||||
log.info(`Client connected`);
|
||||
|
||||
// Game Management
|
||||
socket.on(`HostGame`, (data: HostGame) => HostGame(socket, data));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue