Refactor logging

This commit is contained in:
Calvin Montgomery 2017-04-04 23:02:31 -07:00
parent b1a328d2e0
commit 8306d2d1b6
29 changed files with 268 additions and 194 deletions

View file

@ -1,5 +1,7 @@
import Logger from '../logger';
import uuid from 'uuid';
import { LoggerFactory } from '@calzoneman/jsli';
const LOGGER = LoggerFactory.getLogger('announcementrefresher');
var SERVER;
const SERVER_ANNOUNCEMENTS = 'serverAnnouncements';
@ -31,7 +33,7 @@ class AnnouncementRefresher {
try {
data = JSON.parse(message);
} catch (error) {
Logger.errlog.log('Unable to unmarshal server announcement: ' + error.stack
LOGGER.error('Unable to unmarshal server announcement: ' + error.stack
+ '\nMessage was: ' + message);
return;
}

View file

@ -2,7 +2,9 @@ import Promise from 'bluebird';
import uuid from 'uuid';
import { runLuaScript } from 'cytube-common/lib/redis/lualoader';
import path from 'path';
import Logger from '../logger';
import { LoggerFactory } from '@calzoneman/jsli';
const LOGGER = LoggerFactory.getLogger('partitionchannelindex');
var SERVER = null;
const CHANNEL_INDEX = 'publicChannelList';
@ -16,7 +18,7 @@ class PartitionChannelIndex {
this.uid = uuid.v4();
this.cachedList = [];
this.redisClient.on('error', error => {
Logger.errlog.log(`Redis error: ${error}`);
LOGGER.error(`Redis error: ${error}`);
});
process.nextTick(() => {
@ -34,7 +36,7 @@ class PartitionChannelIndex {
]).then(result => {
this.cachedList = JSON.parse(result);
}).catch(error => {
Logger.errlog.log(`Failed to refresh channel list: ${error.stack}`);
LOGGER.error(`Failed to refresh channel list: ${error.stack}`);
});
}
@ -54,7 +56,7 @@ class PartitionChannelIndex {
});
this.redisClient.hsetAsync(CHANNEL_INDEX, this.uid, entry).catch(error => {
Logger.errlog.log(`Failed to publish local channel list: ${error.stack}`);
LOGGER.error(`Failed to publish local channel list: ${error.stack}`);
});
}