Skip to content

Commit

Permalink
Remove excess logging
Browse files Browse the repository at this point in the history
  • Loading branch information
sulkaharo committed Sep 22, 2020
1 parent 1059232 commit 54008a7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 20 deletions.
2 changes: 1 addition & 1 deletion lib/api/entries/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ function configure (app, wares, ctx, env) {
if (!req.query.find) {

req.query.find = {
type: { "$eq" : type }
type: type
};
} else {
req.query.find.type = type;
Expand Down
7 changes: 1 addition & 6 deletions lib/api/treatments/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,13 @@ function configure (app, wares, ctx, env) {
query.count = 10
}

console.log('Delete records with query: ', query);

// remove using the query
ctx.treatments.remove(query, function(err, stat) {
if (err) {
console.log('treatments delete error: ', err);
return next(err);
}

console.log('treatments records deleted', query);

// yield some information about success of operation
res.json(stat);

Expand Down Expand Up @@ -204,8 +200,7 @@ function configure (app, wares, ctx, env) {
ctx.treatments.save(data, function(err, created) {
if (err) {
res.sendJSONStatus(res, constants.HTTP_INTERNAL_ERROR, 'Mongo Error', err);
console.log('Error saving treatment');
console.log(err);
console.log('Error saving treatment', err);
} else {
res.json(created);
console.log('Treatment saved', data);
Expand Down
12 changes: 5 additions & 7 deletions lib/server/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,19 @@ function cache (env, ctx) {
}

data.insertData = (datatype, newData, retentionPeriod) => {
console.log('inserting to cache', data[datatype].length);
data[datatype] = mergeCacheArrays(data[datatype], newData, retentionPeriod);
console.log('post inserting to cache', data[datatype].length);
}

function dataChanged (operation) {
console.log('Cache data operation requested', operation);
//console.log('Cache data operation requested', operation);

if (!data[operation.type]) return;

if (operation.op == 'remove') {
console.log('Cache data delete event');
//console.log('Cache data delete event');
// if multiple items were deleted, flush entire cache
if (!operation.changes) {
console.log('Multiple items delete from cache, flushing all')
//console.log('Multiple items delete from cache, flushing all')
data.treatments = [];
data.devicestatus = [];
data.entries = [];
Expand All @@ -79,7 +77,7 @@ function cache (env, ctx) {
}

if (operation.op == 'update') {
console.log('Cache data update event');
//console.log('Cache data update event');
data[operation.type] = mergeCacheArrays(data[operation.type], operation.changes);
}
}
Expand All @@ -90,7 +88,7 @@ function cache (env, ctx) {
for (let i = 0; i < array.length; i++) {
const o = array[i];
if (o._id == id) {
console.log('Deleting object from cache', id);
//console.log('Deleting object from cache', id);
array.splice(i, 1);
break;
}
Expand Down
10 changes: 4 additions & 6 deletions lib/server/treatments.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ function storage (env, ctx) {
if (!err) {
if (updateResults.result.upserted) {
obj._id = updateResults.result.upserted[0]._id
console.log('PERSISTENCE: treatment upserted', updateResults.result.upserted[0]);
//console.log('PERSISTENCE: treatment upserted', updateResults.result.upserted[0]);
}
console.log('Update result', updateResults.result);
//console.log('Update result', updateResults.result);
}

// TODO document this feature
Expand Down Expand Up @@ -119,7 +119,7 @@ function storage (env, ctx) {
function remove (opts, fn) {
return api( ).remove(query_for(opts), function (err, stat) {
//TODO: this is triggering a read from Mongo, we can do better
console.log('Treatment removed', opts); // , stat);
//console.log('Treatment removed', opts); // , stat);

ctx.bus.emit('data-update', {
type: 'treatments',
Expand All @@ -139,7 +139,7 @@ function storage (env, ctx) {

function saved (err, created) {
if (!err) {
// console.log('Treatment updated', created);
// console.log('Treatment updated', created);

ctx.ddata.processRawDataForRuntime(obj);

Expand Down Expand Up @@ -268,8 +268,6 @@ function prepareData(obj) {
delete obj.units;
}

console.log('Preparing treatment for insertion, obj', obj, 'results', results);

return results;
}

Expand Down

0 comments on commit 54008a7

Please sign in to comment.