mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
use new logger where possible
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import mongoose from 'mongoose';
|
import mongoose from 'mongoose';
|
||||||
import autoinc from 'mongoose-id-autoinc';
|
import autoinc from 'mongoose-id-autoinc';
|
||||||
import logging from '../website/src/libs/api-v2/logging';
|
import logger from '../website/src/libs/api-v3/logger';
|
||||||
import nconf from 'nconf';
|
import nconf from 'nconf';
|
||||||
import utils from '../website/src/libs/utils';
|
import utils from '../website/src/libs/utils';
|
||||||
import repl from 'repl';
|
import repl from 'repl';
|
||||||
@@ -36,7 +36,7 @@ let improveRepl = (context) => {
|
|||||||
mongooseOptions,
|
mongooseOptions,
|
||||||
function(err) {
|
function(err) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
logging.info('Connected with Mongoose');
|
logger.info('Connected with Mongoose');
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ require('babel/register');
|
|||||||
// Only do the minimal amount of work before forking just in case of a dyno restart
|
// Only do the minimal amount of work before forking just in case of a dyno restart
|
||||||
var cluster = require('cluster');
|
var cluster = require('cluster');
|
||||||
var nconf = require('nconf');
|
var nconf = require('nconf');
|
||||||
var logging = require('./libs/api-v2/logging');
|
var logger = require('./libs/api-v2/logger');
|
||||||
|
|
||||||
// Initialize configuration
|
// Initialize configuration
|
||||||
var setupNconf = require('./libs/api-v3/setupNconf');
|
var setupNconf = require('./libs/api-v3/setupNconf');
|
||||||
@@ -26,7 +26,7 @@ if (cores !== 0 && cluster.isMaster && (IS_DEV || IS_PROD)) {
|
|||||||
cluster.on('disconnect', (worker) => {
|
cluster.on('disconnect', (worker) => {
|
||||||
var w = cluster.fork(); // replace the dead worker
|
var w = cluster.fork(); // replace the dead worker
|
||||||
|
|
||||||
logging.info('[%s] [master:%s] worker:%s disconnect! new worker:%s fork', new Date(), process.pid, worker.process.pid, w.process.pid);
|
logger.info('[%s] [master:%s] worker:%s disconnect! new worker:%s fork', new Date(), process.pid, worker.process.pid, w.process.pid);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
module.exports = require('./server.js');
|
module.exports = require('./server.js');
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// TODO cleanup all comments when finished API v3
|
// TODO cleanup all comments when finished API v3
|
||||||
|
|
||||||
import nconf from 'nconf';
|
import nconf from 'nconf';
|
||||||
import logging from './libs/api-v2/logging';
|
import logger from './libs/api-v3/logger';
|
||||||
import utils from './libs/utils';
|
import utils from './libs/utils';
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import http from 'http';
|
import http from 'http';
|
||||||
@@ -37,7 +37,7 @@ let mongooseOptions = !IS_PROD ? {} : {
|
|||||||
};
|
};
|
||||||
let db = mongoose.connect(nconf.get('NODE_DB_URI'), mongooseOptions, (err) => {
|
let db = mongoose.connect(nconf.get('NODE_DB_URI'), mongooseOptions, (err) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
logging.info('Connected with Mongoose');
|
logger.info('Connected with Mongoose');
|
||||||
});
|
});
|
||||||
|
|
||||||
autoinc.init(db);
|
autoinc.init(db);
|
||||||
@@ -158,7 +158,7 @@ oldApp.use(require('./middlewares/errorHandler'));
|
|||||||
|
|
||||||
server.on('request', app);
|
server.on('request', app);
|
||||||
server.listen(app.get('port'), () => {
|
server.listen(app.get('port'), () => {
|
||||||
return logging.info(`Express server listening on port ${app.get('port')}`);
|
return logger.info(`Express server listening on port ${app.get('port')}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
export default server;
|
export default server;
|
||||||
|
|||||||
Reference in New Issue
Block a user