feat(server): Use debug for prettier logs

This commit is contained in:
Berkeley Martinez
2018-01-06 11:24:08 -08:00
committed by mrugesh mohapatra
parent 020a25bb4f
commit 52529a99b1
3 changed files with 31 additions and 15 deletions

View File

@@ -1,16 +1,22 @@
// this ensures node understands the future
require('babel-register');
const _ = require('lodash');
const createDebugger = require('debug');
const log = createDebugger('fcc:server:production-start');
const startTime = Date.now();
// force logger to always output
// this may be brittle
log.enabled = true;
// this is where server starts booting up
const app = require('./server');
let timeoutHandler;
let killTime = 15;
const onConnect = _.once(() => {
console.log('db connected in: %s', Date.now() - startTime);
log('db connected in: %s', Date.now() - startTime);
if (timeoutHandler) {
clearTimeout(timeoutHandler);
}