fix logger reference error

This commit is contained in:
AlecM33
2022-01-06 11:43:36 -05:00
parent bd863dd683
commit c0a18a6921
8 changed files with 12 additions and 10 deletions

View File

@@ -3,6 +3,8 @@ smoothly when you don't have a deck, or when you and your friends are together v
<a href="https://boardgamegeek.com/boardgame/152242/ultimate-werewolf-deluxe-edition">Ultimate Werewolf</a> and by
2020's quarantine. The app is free to use and anonymous.
![player](./client/src/images/screenshots/player.PNG)
## Features
This is meant to facilitate a game through a shared game state and various utilities - not to control

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@@ -14,7 +14,7 @@ app.use(bodyParser.urlencoded({
const args = ServerBootstrapper.processCLIArgs();
const logger = require('./modules/Logger')(args.logLevel);
logger.log('LOG LEVEL IS: ' + args.logLevel);
logger.info('LOG LEVEL IS: ' + args.logLevel);
const main = ServerBootstrapper.createServerWithCorrectHTTPProtocol(app, args.useHttps, args.port, logger)
@@ -66,5 +66,5 @@ app.use(function (req, res) {
});
main.listen(args.port, function () {
logger.log(`Starting server on port ${args.port}` );
logger.info(`Starting server on port ${args.port}` );
});

View File

@@ -64,7 +64,7 @@ class ActiveGameRunner {
class Singleton {
constructor (logger) {
if (!Singleton.instance) {
logger.log('CREATING SINGLETON ACTIVE GAME RUNNER');
logger.info('CREATING SINGLETON ACTIVE GAME RUNNER');
Singleton.instance = new ActiveGameRunner(logger);
}
}

View File

@@ -450,7 +450,7 @@ function pruneStaleGames(activeGames, timerThreads, logger) {
class Singleton {
constructor (logger, environment) {
if (!Singleton.instance) {
logger.log('CREATING SINGLETON GAME MANAGER');
logger.info('CREATING SINGLETON GAME MANAGER');
Singleton.instance = new GameManager(logger, environment);
}
}

View File

@@ -3,7 +3,7 @@ const globals = require('../config/globals');
module.exports = function (logLevel = globals.LOG_LEVEL.INFO) {
return {
logLevel: logLevel,
log (message = '') {
info (message = '') {
const now = new Date();
console.log('LOG ', now.toGMTString(), ': ', message);
},

View File

@@ -38,7 +38,7 @@ const ServerBootstrapper = {
createServerWithCorrectHTTPProtocol: (app, useHttps, port, logger) => {
let main;
if (process.env.NODE_ENV.trim() === 'development') {
logger.log('starting main in DEVELOPMENT mode.');
logger.info('starting main in DEVELOPMENT mode.');
if (
useHttps
&& fs.existsSync(path.join(__dirname, '../../client/certs/localhost-key.pem'))
@@ -46,13 +46,13 @@ const ServerBootstrapper = {
) {
const key = fs.readFileSync(path.join(__dirname, '../../client/certs/localhost-key.pem'), 'utf-8');
const cert = fs.readFileSync(path.join(__dirname, '../../client/certs/localhost.pem'), 'utf-8');
logger.log('local certs detected. Using HTTPS.');
logger.info('local certs detected. Using HTTPS.');
main = https.createServer({ key, cert }, app);
logger.log(`navigate to https://localhost:${port}`);
logger.info(`navigate to https://localhost:${port}`);
} else {
logger.log('https not specified or no local certs detected. Certs should reside in /client/certs. Using HTTP.');
logger.info('https not specified or no local certs detected. Certs should reside in /client/certs. Using HTTP.');
main = http.createServer(app);
logger.log(`navigate to http://localhost:${port}`);
logger.info(`navigate to http://localhost:${port}`);
}
} else {
logger.warn('starting main in PRODUCTION mode. This should not be used for local development.');