From 72cc9450544c423e7c48a6eddc970efdaa6395dd Mon Sep 17 00:00:00 2001 From: Jakob Rosenberg Date: Sat, 17 Oct 2020 17:05:42 +0200 Subject: [PATCH] list functions in dumps --- lib/plugins/debugger/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/plugins/debugger/index.js b/lib/plugins/debugger/index.js index 31f0cb5..2799c97 100644 --- a/lib/plugins/debugger/index.js +++ b/lib/plugins/debugger/index.js @@ -53,7 +53,7 @@ module.exports.default = { app.log.debug(chalker(`[events] ${event}`)) const name = `${eventCount}.${event.replace(':', '-')}` - const snapshot = JSON.stringify(app, null, 2) + const snapshot = JSON.stringify(app, replacer, 2) outputFileSync(`${EVENTSFOLDER + name}.json`, snapshot) const delta = jsondiffpatch.diff(JSON.parse(snapshot), JSON.parse(lastSnapshot)) if (delta) { @@ -146,7 +146,7 @@ function getEventStateFromPrevExec(app) { function logEventHook(app, hook, plugin) { - if(hook.event !== '*'){ + if (hook.event !== '*') { const name = hook.name ? `- ${hook.name}` : '' const params = chalk.hex(subtle)(JSON.stringify(plugin.params)) app.log.debug(chalker(`[events] ${plugin.name} ${name} ${params}`)) @@ -171,3 +171,10 @@ function wrapErrorHandler(app) { errorHandler(err, app) } } + +function replacer(key, val) { + if (typeof val === 'function') { + return '' + } + return val +}