Skip to content

Commit

Permalink
Merge pull request #548 from jsnoble/logger_refactor
Browse files Browse the repository at this point in the history
refactored makeLogger call to use single config object resolves #543
  • Loading branch information
godber authored Sep 16, 2017
2 parents b150d7e + 5f95957 commit 5a43996
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/cluster/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var parseError = require('../utils/error_utils').parseError;

// this is a child process spawned by node_master to download assets
module.exports = function(context) {
var logger = context.foundation.makeLogger('asset_manager', 'asset_manager', {module: 'asset_manager'});
var logger = context.foundation.makeLogger({module: 'asset_manager'});
var clusterConfig = context.sysconfig.teraslice;

var messaging = messageModule(context, logger);
Expand Down
2 changes: 1 addition & 1 deletion lib/cluster/cluster_master.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var makeLogs = require('./storage/logs');
var messageModule = require('./services/messaging');

module.exports = function(context) {
var logger = context.foundation.makeLogger('cluster_master', 'cluster_master', {module: 'cluster_master'});
var logger = context.foundation.makeLogger({module: 'cluster_master'});
var clusterConfig = context.sysconfig.teraslice;
var parseError = require('../utils/error_utils').parseError;
var events = context.foundation.getEventEmitter();
Expand Down
2 changes: 1 addition & 1 deletion lib/cluster/moderator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var messageModule = require('./../services/messaging');
var parseError = require('../../utils/error_utils').parseError;

module.exports = function(context) {
var logger = context.foundation.makeLogger('moderator', 'moderator', {module: 'moderator'});
var logger = context.foundation.makeLogger({module: 'moderator'});
var interval = context.sysconfig.teraslice.moderator_interval;
var messaging = messageModule(context, logger);
var host = messaging.getHostUrl();
Expand Down
2 changes: 1 addition & 1 deletion lib/cluster/node_master.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function portAllocator(sysconfig) {

module.exports = function(context) {
var cluster = context.cluster;
var logger = context.foundation.makeLogger('node_master', 'node_master', {module: 'node_master'});
var logger = context.foundation.makeLogger({module: 'node_master'});
var configWorkerLimit = context.sysconfig.teraslice.workers;
var systemPorts = portAllocator(context.sysconfig);

Expand Down
2 changes: 1 addition & 1 deletion lib/cluster/services/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var makeTable = require('../../utils/api_utils').makeTable;
var sendError = require('../../utils/api_utils').sendError;

module.exports = function(context, app, services) {
var logger = context.foundation.makeLogger('api', 'api', {module: 'api_service'});
var logger = context.foundation.makeLogger({module: 'api_service'});
var cluster_service = services[0];
var jobs_service = services[1];
var assetsUrl = `http://${context.sysconfig.teraslice.master_hostname}:${process.env.assets_port}`;
Expand Down
2 changes: 1 addition & 1 deletion lib/cluster/services/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var sendError = require('../../utils/api_utils').sendError;
var _ = require('lodash');

module.exports = function(context) {
var logger = context.foundation.makeLogger('assets_service', 'assets_service', {module: 'assets_service'});
var logger = context.foundation.makeLogger({module: 'assets_service'});
var assets_store;
var messageModule = require('./messaging');
var messaging = messageModule(context, logger);
Expand Down
2 changes: 1 addition & 1 deletion lib/cluster/services/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var sendError = require('../../utils/api_utils').sendError;
module.exports = function(context, server) {
var messaging = context.messaging;
var events = context.foundation.getEventEmitter();
var logger = context.foundation.makeLogger('cluster', 'cluster', {module: 'cluster_service'});
var logger = context.foundation.makeLogger({module: 'cluster_service'});
var configTimeout = context.sysconfig.teraslice.network_timeout;
var pendingWorkerRequests = new Queue();
var moderator = null;
Expand Down
2 changes: 1 addition & 1 deletion lib/cluster/services/jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var MESSAGE_MAPPING = {

module.exports = function(context, cluster_service) {
var events = context.foundation.getEventEmitter();
var logger = context.foundation.makeLogger('jobs', 'jobs', {module: 'jobs_service'});
var logger = context.foundation.makeLogger({module: 'jobs_service'});
var esConnectionState = context.sysconfig.teraslice.state.connection;
var job_store;
var ex_store;
Expand Down
2 changes: 1 addition & 1 deletion lib/cluster/slicer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = function(context) {
var job_id = process.env.job_id;
var events = context.foundation.getEventEmitter();
var job_runner = require('./runners/job')(context);
var logger = context.foundation.makeLogger('slicer', 'slicer', {ex_id: ex_id, module: 'slicer'});
var logger = context.foundation.makeLogger({module: 'slicer', ex_id: ex_id});
var messaging = messageModule(context, logger);

//Stateful variables
Expand Down
6 changes: 3 additions & 3 deletions lib/cluster/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = function(context) {
//this will store errors and the number of retries
var errorLog = {};

var logger = context.foundation.makeLogger('worker', ID, {
var logger = context.foundation.makeLogger({
ex_id: ex_id,
module: 'worker',
worker_id: ID
Expand All @@ -54,9 +54,9 @@ module.exports = function(context) {
//getting a slice means the previous message was handled
sentMessage = false;
logger.info(`received slice: ${msg.data.slice_id}`);
var sliceLogger = context.foundation.makeLogger('worker_slice', ID, {
var sliceLogger = context.foundation.makeLogger({
ex_id: ex_id,
module: 'worker',
module: 'slice',
worker_id: ID,
slice_id: msg.data.slice_id
});
Expand Down

0 comments on commit 5a43996

Please sign in to comment.