added console logs to config startups

This commit is contained in:
bill bittner 2018-03-27 13:21:59 -07:00
parent e9ecb1e2fe
commit 955a2f5e14
8 changed files with 383 additions and 219 deletions

View file

@ -6,6 +6,7 @@ function LoggerConfig () {
if (!config) {
return console.log('No logger config received.');
}
console.log('configuring winston logger...');
// update values with local config params
const {logLevel} = config;
this.logLevel = logLevel;
@ -23,6 +24,7 @@ function LoggerConfig () {
],
});
// test all the log levels
console.log('testing winston log levels...');
logger.error('Level 0');
logger.warn('Level 1');
logger.info('Level 2');

View file

@ -6,6 +6,7 @@ function mysql () {
if (!config) {
return console.log('No MySQL config received.');
}
console.log('configuring mysql credentials...');
const {database, username, password} = config;
this.database = database;
this.username = username;

View file

@ -7,9 +7,10 @@ function SlackConfig () {
this.slackInfoChannel = 'default';
this.configure = (config) => {
if (!config) {
return console.log('No slack config received.');
return console.log('no slack config received');
}
// update variables
console.log('configuring slack logger...');
const {slackWebHook, slackErrorChannel, slackInfoChannel} = config;
this.slackWebHook = slackWebHook;
this.slackErrorChannel = slackErrorChannel;
@ -38,6 +39,7 @@ function SlackConfig () {
});
};
// send test messages
console.log('testing slack logger...');
winston.error('Slack "error" logging is online.');
winston.info('Slack "info" logging is online.');
} else {

583
index.js

File diff suppressed because one or more lines are too long

1
index.js.map Normal file

File diff suppressed because one or more lines are too long

View file

@ -2,7 +2,8 @@ const Sequelize = require('sequelize');
const logger = require('winston');
logger.info('exporting sequelize models');
const { database, username, password } = require('../../config/mysqlConfig');
const mysqlConfig = require('../../config/mysqlConfig');
const { database, username, password } = mysqlConfig;
const db = {};
// set sequelize options

View file

@ -1,6 +1,6 @@
const PassportLocalStrategy = require('passport-local').Strategy;
const logger = require('winston');
const db = require('../models/index');
const db = require('../models');
const returnUserAndChannelInfo = (userInstance) => {
return new Promise((resolve, reject) => {

View file

@ -7,6 +7,8 @@ const logger = require('./config/loggerConfig.js');
const mysql = require('./config/mysqlConfig.js');
const slack = require('./config/slackConfig.js');
const database = require('./server/models');
const localLoginStrategy = require('./server/passport/local-login.js');
const localSignupStrategy = require('./server/passport/local-signup.js');
const exports = {
// Server,
@ -20,6 +22,10 @@ const exports = {
slack,
},
database,
passport: {
localLoginStrategy,
localSignupStrategy,
},
};
module.exports = exports;