Skip to content

Commit

Permalink
Use util.inspect to print detailed info about params
Browse files Browse the repository at this point in the history
  • Loading branch information
bwtimm committed Sep 25, 2017
1 parent 624426e commit 26cce3e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/handler.js
@@ -1,3 +1,5 @@
const util = require('util');

const fnArgs = require('function-arguments');
const errors = require('./errors');

Expand Down Expand Up @@ -132,7 +134,7 @@ function handler(methodSchema) {
const match = getMatchFn(normalizedSchema);

function validateParams(ctx, params) {
safeLog(ctx, `Validating request parameters: ${params}`);
safeLog(ctx, `Validating request parameters: ${util.inspect(params)}`);

const result = match(params);
ctx.swatchCtx.keys = result.keys; // Array of ordered arg names
Expand All @@ -143,7 +145,7 @@ function handler(methodSchema) {
const args = ctx.swatchCtx.keys.map(key => (
ctx.swatchCtx.params[key]
));
safeLog(ctx, `Executing swatch handler with arguments: ${args}`);
safeLog(ctx, `Executing swatch handler with arguments: ${util.inspect(args)}`);

return normalizedSchema.handler.apply(ctx.swatchCtx, args);
}
Expand Down

0 comments on commit 26cce3e

Please sign in to comment.