Skip to content

Commit

Permalink
stringify and ensure meta is not set for logs
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcgrath committed Dec 16, 2016
1 parent 8475711 commit d305a9d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
5 changes: 2 additions & 3 deletions lib/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ module.exports.getLogger = function() {
transports: [
new (winston.transports.Console)({
level: properties.logLevel,
json: false,
json: true,
stringify: true,
timestamp: true,
prettyPrint: true
timestamp: true
})
]
});
Expand Down
9 changes: 4 additions & 5 deletions lib/resources/elasticgroup/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ var create = function(err, event, context) {
spotUtil.getTokenAndConfig(event, function(err, tc) {
if(err) return spotUtil.done(err, event, context);

log.debug("Spotinst Create Event");
log.debug(event);
log.debug("Spotinst Create Event", event, {});

var createOptions = {
method: 'POST',
Expand All @@ -27,10 +26,10 @@ var create = function(err, event, context) {
}
};

log.info('Creating group config', tc.config);
log.info('Creating group config', tc.config, {});
request(createOptions, function(err, res, body) {

log.debug("Create group payload",body);
log.debug("Create group payload",body, {});

spotUtil.validateResponse({
err: err,
Expand All @@ -41,7 +40,7 @@ var create = function(err, event, context) {
resource: 'elasticgroup',
action: 'create',
successCb: function(spotResponse) {
log.debug("Create Success Callback",spotResponse);
log.debug("Create Success Callback");
spotUtil.done(err, event, context, body, body.response.items[0].id);
}
});
Expand Down
2 changes: 1 addition & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ var validateResponse = module.exports.validateResponse = function(spotResponse)
var context = spotResponse.context;

//log.info('Spotinst response',JSON.stringify(body, null, 2));
log.info('Spotinst response',body);
log.info('Spotinst response',body, {});

if(res.statusCode > 201) {
var errMsg = '';
Expand Down
2 changes: 1 addition & 1 deletion test/elasticgroup/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var groupConfig = {
}

describe("elasticgroup", function() {
describe("create resource", function() {
describe.only("create resource", function() {
before(function() {
for (var i=0; i<4; i++) {
nock('https://api.spotinst.io', {"encodedQueryParams":true})
Expand Down

0 comments on commit d305a9d

Please sign in to comment.