Browse Source

Merge pull request #445 from vesameskanen/no-stringify-logging

Remove expensive JSON.stringify from api debug logging calls
pull/534/head
Diana Shkolnikov 9 years ago
parent
commit
e4647eaeaf
  1. 4
      controller/place.js
  2. 4
      controller/search.js

4
controller/place.js

@ -22,7 +22,7 @@ function setup( backend ){
}; };
}); });
logger.debug( '[ES req]', JSON.stringify(query) ); logger.debug( '[ES req]', query );
service.mget( backend, query, function( err, docs ) { service.mget( backend, query, function( err, docs ) {
console.log('err:' + err); console.log('err:' + err);
@ -35,7 +35,7 @@ function setup( backend ){
else { else {
res.data = docs; res.data = docs;
} }
logger.debug('[ES response]', JSON.stringify(docs)); logger.debug('[ES response]', docs);
next(); next();
}); });

4
controller/search.js

@ -31,7 +31,7 @@ function setup( backend, query ){
cmd.type = req.clean.layers; cmd.type = req.clean.layers;
} }
logger.debug( '[ES req]', JSON.stringify(cmd) ); logger.debug( '[ES req]', cmd );
// query backend // query backend
service.search( backend, cmd, function( err, docs, meta ){ service.search( backend, cmd, function( err, docs, meta ){
@ -49,7 +49,7 @@ function setup( backend, query ){
res.data = docs; res.data = docs;
res.meta = meta; res.meta = meta;
} }
logger.debug('[ES response]', JSON.stringify(docs)); logger.debug('[ES response]', docs);
next(); next();
}); });

Loading…
Cancel
Save