logger func to better know when and where soemthing was logged

This commit is contained in:
Zutatensuppe 2021-04-13 20:18:41 +02:00
parent 37022eaa6d
commit 0c238dd9f1
10 changed files with 83 additions and 31 deletions

View file

@ -1,11 +1,13 @@
import fs from 'fs'
import GameCommon from './../common/GameCommon.js'
import Util from './../common/Util.js'
import Util, { logger } from './../common/Util.js'
import { Rng } from '../common/Rng.js'
import GameLog from './GameLog.js'
import { createPuzzle } from './Puzzle.js'
import Protocol from '../common/Protocol.js'
const log = logger('Game.js')
const DATA_DIR = './../data'
function loadAllGames() {
@ -27,7 +29,7 @@ function loadGame(gameId) {
try {
game = JSON.parse(contents)
} catch {
console.log(`[ERR] unable to load game from file ${file}`);
log.log(`[ERR] unable to load game from file ${file}`);
}
if (typeof game.puzzle.data.started === 'undefined') {
game.puzzle.data.started = Math.round(fs.statSync(file).ctimeMs)