diff --git a/src/main.ts b/src/main.ts index 6b96629..e8662be 100644 --- a/src/main.ts +++ b/src/main.ts @@ -35,13 +35,15 @@ const db_dir = `data`; * whatever reason. It cleans up and writes all the active games to the disk. */ function clean_up() { + log.info(`Cleaning up games...`); for (var code in active_games) { - console.log(`Writing game: ${code} to disk`); - writeFileSync(`${db_dir}/${code}`, active_games[code].toJSON()); + log.debug(`Writing game: ${code} to disk`); + log.silly(active_games[code]); + // writeFileSync(`${db_dir}/${code}`, active_games[code].toJSON()); }; - log.info(`Finished saving games to disk.`); + log.info(`Finished cleanup. Exiting.`); process.exit(0); -} +}; // Listen to the signals for the cleanup requirement process.on(`uncaughtException`, clean_up);